[摘要]这是一个由平面视频切换到全景视频的案例,在播放完平面视频后自动切换,请耐心观看完毕才会切换哦。
tour.XML文件
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 |
<krpano logkey="true"> <include url="videoplayer.xml" /> <set var="device.ie" val="true" if="device.mac AND (device.safariversion GE '11.0.2')" /> <!-- startup action - load the first scene --> <action name="startup" autorun="onstart"> if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); ); loadscene(get(startscene), null, MERGE); if(startactions !== null, startactions() ); </action> <scene name="scene_1" title="a1" onstart="" > <preview type="grid(cube,64,64,512,0x666666,0x222222,0x222222);" details="16"/> <view hlookat="0" /> <hotspot name="spot1" type="text" ath="0" atv="0" html="CLICK ME" css="color:#ffffff" bgcolor="0x336699" padding="4 10" onclick="MakeFlatVdo" /> </scene> <scene name="scene_2" title="video360" onstart="ChangeVideoScene(ski);" > <view hlookat="0" vlookat="0" fov="90" fovmin="60" fovmax="110" limitview="on" /> <image> <sphere url="plugin:video" /> </image> </scene> <layer name="flat_bg" type="container" keep="true" width="100%" height="100%" autoalpha="true" alpha="0" bgcolor="0x333333" bgalpha="1" zorder="50" /> </krpano> |
videoplayer.xml文件
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
<krpano> <plugin name="video" preload="true" keep="true" url="plugins/videoplayer.js" videourl="" posterurl="" align="center" x="0" y="-10" pausedonstart="false" loop="false" volume="1.0" onvideoready="" onvideoplay="" onvideopaused="" onvideocomplete="" onerror="" zorder="60" panovideo="false" autoresume="true" /> <events name="flattvdosize" keep="true" onresize="FlatVideoSize" /> <action name="FlatVideoSize"> set(_vdoscale, calc:stagewidth / stageheight); if(_vdoscale LT 1.78, set(layer[video], width=80%, height=prop); , set(layer[video], height=80%, width=prop); ); </action> <action name="ChangeVideoScene" devices="desktop"> set(plugin[video].posterurl, calc:'video/%1-2k-poster.jpg'); plugin[video].playvideo(video/%1-2k.mp4|video/%1-2k.webm); </action> <action name="MakeFlatVdo"> tween(layer[flat_bg].alpha,0.8,1); plugin[video].playvideo(video/videoflat.mp4); set(plugin[video].onvideocomplete, Video360()); </action> <action name="Video360"> tween(layer[flat_bg].alpha,0,1); set(plugin[video].panovideo,true); set(events[flattvdosize].onresize, ); loadscene(scene_2); delayedcall(1, set(plugin[video].onvideocomplete, plugin[video].stop(); loadscene(scene_1); set(hotspot[spot1].visible,0); delayedcall(0.5, MakeFlatVdo(); set(plugin[video],panovideo=false, zorder=60,alpha=1,visible=true,align=center,x=0,y=-10); set(events[flattvdosize].onresize, FlatVideoSize()); ); ); ); </action> </krpano> |