You are not logged in.

KiboOst

Trainee

  • "KiboOst" started this thread

Posts: 83

Location: France

Occupation: TD

  • Send private message

1

Tuesday, July 5th 2016, 10:11am

videointerface_addsource and several videos

Can anyone enlighten me on how to set several videos scenes in same pano ?

here is an example:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<krpano version="1.19" bgcolor="0xFFFFFF" showlog="false" showerrors="false">
	<scene name="myVideo1" title="myVideo1" onstart="">
    	<include url="%CURRENTXML%/skin/videointerface.xml" />
    	<plugin name="video" keep="false"
            	url.html5="%SWFPATH%/plugins/videoplayer.js"
            	url.flash="%SWFPATH%/plugins/videoplayer.swf"
            	pausedonstart="true" loop="false" volume="1.0" buffertime="1.5"
            	onloaded="add_video_sources();"
            	/>
    	<image>
        	<sphere url="plugin:video" />
    	</image>
    	<view hlookat="0" vlookat="0" fovtype="DFOV" fov="115" fovmin="85" fovmax="130" distortion="0.0" architectural="1" />
    	<action name="add_video_sources">
        	videointerface_addsource('Low 1024', '%CURRENTXML%/videos/myVideo1-1024x512.webm|%CURRENTXML%/videos/myVideo1-1024x512.mp4', '%CURRENTXML%/videos/myVideo1_1920-960.jpg');
        	videointerface_addsource('High 1920', '%CURRENTXML%/videos/myVideo1-1920x960.webm|%CURRENTXML%/videos/myVideo1-1920x960.mp4', '%CURRENTXML%/videos/myVideo1_1920-960.jpg');

        	if(device.mobile, videointerface_play('Low 1024'); );
        	if(device.tablet, videointerface_play('High 1920'); );
        	if(device.desktop, videointerface_play('High 1920'); );
    	</action>
	</scene>
	<scene name="myVideo2" title="myVideo2" onstart="">
    	<include url="%CURRENTXML%/skin/videointerface.xml" />
    	<plugin name="video" keep="false"
            	url.html5="%SWFPATH%/plugins/videoplayer.js"
            	url.flash="%SWFPATH%/plugins/videoplayer.swf"
            	pausedonstart="true" loop="false" volume="1.0" buffertime="1.5"
            	onloaded="add_video_sources();"
            	/>
    	<image>
        	<sphere url="plugin:video" />
    	</image>
    	<view hlookat="0" vlookat="0" fovtype="DFOV" fov="115" fovmin="85" fovmax="130" distortion="0.0" architectural="1" />
    	<action name="add_video_sources">
        	videointerface_addsource('Low 1024', '%CURRENTXML%/videos/myVideo2-1024x512.webm|%CURRENTXML%/videos/myVideo2-1024x512.mp4', '%CURRENTXML%/videos/myVideo2_1920-960.jpg');
        	videointerface_addsource('High 1920', '%CURRENTXML%/videos/myVideo2-1920x960.webm|%CURRENTXML%/videos/myVideo2-1920x960.mp4', '%CURRENTXML%/videos/myVideo2_1920-960.jpg');

        	if(device.mobile, videointerface_play('Low 1024'); );
        	if(device.tablet, videointerface_play('High 1920'); );
        	if(device.desktop, videointerface_play('High 1920'); );
    	</action>
	</scene>
</krpano>


First time I go to myVideo1 or myVideo2, all is good
if I switch to the other video, the quality menu is empty !

How can I reset the quality sub menu to add new sources ?

KiboOst

Trainee

  • "KiboOst" started this thread

Posts: 83

Location: France

Occupation: TD

  • Send private message

2

Tuesday, July 5th 2016, 11:24am

ok, this work :

<events onremovepano="
set(skin_video_setup_done, false);
videosources.removearrayitem('vLow 1024');
videosources.removearrayitem('vHigh 1920');
" />

3

Tuesday, July 12th 2016, 5:13pm

Hello, I just wondered how the <sphere> tag knows which of the videos to load? I have trouble with this while using the webvr example as a template.

Posts: 19

Location: Planet Earth

  • Send private message

4

Friday, March 9th 2018, 3:33pm

Hey, this post was vital to overcome this, because I found the exact same difficulty.

You need to clear the array in order to work properly.

First time using arrays in Krpano, it was not that easy to undersantand the few documentation on how to control them.
Of cource you can use a loop, but it should be easier to check what's inside the array or object, like a print_r($array); in PHP.

So I needed to clear all the items in an array to find space for a second video with other quality settings and did not find a delete array command, just using the videointerface_addsource action on videointerface.xml as a way to substitute item won't cut it.

Finally understood the right syntax, but found strangely that a loop will only delete half of the items. So for a 6 items arrays I had to apply 3 times the same loop. Don't understand why, but this code helped me in this scenario:

Source code

1
2
3
4
5
6
7
8
9
10
set(skin_video_setup_done, false);
trace(videosources.count); 
for(set(i,0), i LT videosources.count, inc(i),
	trace(get(i));
	trace(videosources[get(i)].sourcename);
	trace(videosources[get(i)].videourl);
	trace(videosources[get(i)].posterurl);
	videosources.removearrayitem(get(i));
);
trace(videosources.count);


Updates on array scripting would be highly appreciated!

5

Tuesday, March 13th 2018, 10:19am

Hi,

sorry, but the videopano example is not designed for tours.

Videopanos can be used in tours of course, but the videointerface.xml from that example is simply not made for that.

Best regards,
Klaus

6

Monday, June 24th 2019, 4:05pm

Hi,

i added a remove sources method in videointerface.xml :

Source code

1
2
3
4
5
<action name="videointerface_removesources">
    trace('remove sources');
    set(skin_video_setup_done, false);
    loop(videosources.count, videosources.removearrayitem(0););
</action>


in my videopano.xml file :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<action name="src">

    trace('set sources');
    
    videointerface_removesources();

    videointerface_addsource('1024x512',
   	 '/path/to/1024x512.mp4|/path/to/1024x512.webm|/path/to/audio.m4a',
   	 '/path/to/1024x512.jpg'
    );
    
    // add more sources

    videointerface_play('1024x512');
</action>