Sie sind nicht angemeldet.

1

Dienstag, 5. Juli 2016, 10:11

videointerface_addsource and several videos

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

here is an example:

Quellcode

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 ?

2

Dienstag, 5. Juli 2016, 11:24

ok, this work :

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

3

Dienstag, 12. Juli 2016, 17:13

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.

4

Freitag, 9. März 2018, 15:33

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:

Quellcode

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

Dienstag, 13. März 2018, 10:19

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