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

Thursday, June 17th 2021, 3:05pm

Change videourl for video transistions

Hi,


I am trying to implement video transitions between different scenes. I already got it working by creating a layer outside the scenes in following way:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<layer name="video"
  	url.html5="plugins/videoplayer.js"
 	url.flash="pugins/videoplayer.swf"
   	videourl="gehen.mp4"
   	align="center" x="0" y="0"
   	width="100%" height="prop"
   	pausedonstart="true"
	keep="true"
	alpha="0"
	visible="false"
	enabled="false"
   	loop="false"
   	volume="1.0"
   	onvideoready=""
   	onvideoplay=""
   	onvideopaused=""
   	onvideocomplete="tween(layer[video].alpha, 0, 1); delayedcall(2, set(layer[video].visible, false));"
   	onerror=""
/>

And within the scene I create a hotspot, which calls an action to set the video active, play the video and change to the next scene in the background of the video. This also works fine with the following code:

Source code

1
2
3
4
5
6
7
8
<hotspot name="videotest" url="skin/vtourskin_hotspot.png" ath="-20.205" atv="32.860" onclick="video_blend();" />

<action name="video_blend">
    set(layer[video].visible, true);
    layer[video].play();
    tween(layer[video].alpha, 1, 1);
    loadscene(scene_Standpunkt_2_edit, null, MERGE, NOBLEND);
</action>

Now in the next scene I would like to use

Source code

1
set(layer[video].videourl, gehen_2.mp4);
to update the video url for the next transition (that is from scene 2 to scene 3 for example). However this doesn´t seem to work. If I call the action to play the video after updating the video url it still uses the first video and not the new one with the updated url. Is set(layer[video].videourl, new_url.mp4); possible to use?


If it´s not possible, what could be a workaround? I thought about creating a bunch of video layers in the beginning and then later use the one I need for my transition as I did above. However I´m not sure if these many layers will affect the performance of my tour when I a need a lot of different transition videos (although they are set to visible="false" and enabled="false").
It would be great to hear your oppinion and suggestions.
Regards
Martin

2

Friday, June 25th 2021, 10:55am

Hi Martin,

If you are still trying to find out the solution, This is how I generally do it to play different videos.


Source code

1
function play_video(video_name){  var krpano = document.getElementById("krpanoViewer");  video_url = "%CURRENTXML%/videos/"+video_name;  krpano.call("layer[video].playvideo("+video_url+");");}


Though I have used JS code but you can do it through krpano actions too. Idea is to use playvideo functionality and pass the url.

Hope this helps. *smile*

3

Monday, June 28th 2021, 8:23am

Thanks Amit for your tip. Have you noticed some delay because of the buffering of the video? I think in your JS code the video will be opened and start to play right away. As far as I understood with the videolayer which is paused on start, the video will be preloaded and therefore no latency should be noticeable when I start the video.
Is the layer[video] in your code the same layer as I have written in my first code snippet?

4

Monday, October 25th 2021, 10:00am

Hi there,

I´m hijacking your thread because I´m facing the same problem: set(layer[video].url,***** does´nt have any effect on existing videos *sad*
And even layer[video].playvideo(URL) does´nt work very reliable. Sometimes it works, sometimes not and the old video starts again.

Is there any reliable way to change a video-url? I know I could create an action which removes the old layer and creates a new one with the new url, but I need to change the existing video, because it´s the ONLY way to autoplay a video on mobile devices in VR-mode, because of the needed touch-action to start a video.

Thx in advance,
NUPSI