You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, July 28th 2015, 11:11am

How can i change video source externally by js? for example, videourl.no-iosand and videourl.ios.

Here is the xml code of video plugin, but i want to change the video url from js, is there any solution?
It seems that i can use the " krpano Javascript-Interface object" set(variable,value) method, but what is the varible?




<plugin name="video"
▽ url.flash="%SWFPATH%/plugins/videoplayer.swf"
url.html5="%SWFPATH%/plugins/videoplayer.js"

posterurl.ios="../resource/VRm_low.jpg"
videourl.ios="../resource/VRm_low.mp4|VRm_low.webm"


posterurl.no-ios="../resource/VRm_high.jpg"
videourl.no-ios="../resource/VRm_high.mp4|VRm_high.webm"

pausedonstart="true"
loop="true"
enabled="false"
zorder="0"
align="center" ox="0" oy="0"

width.no-panovideosupport="100%"
height.no-panovideosupport="prop"

onloaded="videointerface_setup_interface(get(name)); setup_video_controls();"
onvideoready="videointerface_videoready();"
/>

2

Tuesday, July 28th 2015, 11:33am

Hi,

that's static xml code, for dynamic code you should use the playvideo() action:
http://krpano.com/plugins/videoplayer/#playvideo

and the call() interface:
http://krpano.com/docu/js/#top

e.g.

Source code

1
2
3
4
if(...is iOS...)
  krpano.call("plugin[video].playvideo('video_low.mp4', 'poster_low.jpg');");
else
  krpano.call("plugin[video].playvideo('video_hi.mp4', 'poster_hi.jpg');");


Best regards,
Klaus

3

Tuesday, July 28th 2015, 12:17pm

sorry, the video did not change , what is the problem? is my video path wrong? but i have tried all kinds of path, none worked.

html path: "."
video path: "./resource/VRm_high.mp4";
xml path: "./xml/video.xml"

<script>
function churl(){
var krpano =document.getElementById("krpanoSWFObject");
krpano.call("plugin[video].playvideo('../resource/VRm_high.mp4')");
//krpano.call("plugin[video].playvideo('resource/VRm_high.mp4')");
//krpano.call("plugin[video].playvideo('VRm_high.mp4')");

}
</script>

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Tuesday, July 28th 2015, 4:23pm

Try opening the javascript console and the krpano console. That should show any errors.

Also in the javascript console you can run krpano commands directly.

Also post a link to your tour.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

5

Wednesday, July 29th 2015, 4:56am

[Solved] change the video path through javacript

First of all, thank you all for giving me methods and advice. Now the problem can be solved by two means:

Firstly, use krpano object call function. when the page is loaded, call the function churl() to change the video source

Source code

1
<script>     function churl(){        var krpano =document.getElementById("krpanoSWFObject");        krpano.call("plugin[video].playvideo('resource/VRm_high.mp4')");        }</script>



Secondly, when the krpano is embedded some parameters can be set to change the xml file. REFERENCE: http://krpano.com/docu/html/#vars


And the second method can truly solve my problem.

6

Thursday, February 4th 2016, 10:28am

Hi,

that's static xml code, for dynamic code you should use the playvideo() action:
http://krpano.com/plugins/videoplayer/#playvideo

and the call() interface:
http://krpano.com/docu/js/#top

e.g.

Source code

1
2
3
4
if(...is iOS...)
  krpano.call("plugin[video].playvideo('video_low.mp4', 'poster_low.jpg');");
else
  krpano.call("plugin[video].playvideo('video_hi.mp4', 'poster_hi.jpg');");


Best regards,
Klaus
This `if(...is iOS...)` is a little confusing. What's the code to actually detect ios/firefox with krpano?

Wouldn't it be better to just set the plugin like so:

Source code

1
krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].onclick, set( plugin[video].videourl.no-ios,/panorama/"+ data[d].id +"/video-1920x960.mp4|/panorama/"+ data[d].id +"/video-1920x960.webm ); set( plugin[video].videourl.ios,/panorama/"+ data[d].id +"/video-1344x672.mp4|/panorama/"+ data[d].id +"/video-iphone-sound.mp3 ); changepano( loadscene(video_scene, null, MERGE|KEEPVIEW|KEEPMOVING, BLEND(1)); ););");



The device/browser detection is already integrated this way. However, I'm finding that my suggested method does not work