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, June 28th 2016, 4:44pm

Share a videoplayer plugin instance between 2d and 3d video scenes

Hello everyone,

For my krpano based project, I’m trying to switch between 2d and 3d video scenes.

According to the documentation, in order to render flat videos, the <layer /> notation is needed although to render 3d videos <image /> along with a <sphere /> is needed.

Here is a highly simplified version of my code which works:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<krpano onstart="loadscene('video_2d');">
  <scene name="video_2d">
    <layer name="video"
           url="../plugins/videoplayer.js"
           videourl="video_2d.mp4"
           onvideocomplete="loadscene('video_3d')" />
  </scene>
  <scene name="video_3d">
    <plugin name="video_3d"
            url="../plugins/videoplayer.js"
            videourl="video_3d.mp4" />
    <image>
     <sphere url="plugin:video_3d" />
    </image>
  </scene>
</krpano>


My question is the following: how can I can refactor this code to share the same video plugin instance instead of duplicating it with the url="../plugins/videoplayer.js”.

Would it be possible to put it in a shared layer and reuse it in each scene? That way, I can make sure the performance is the best and it wouldn't have problems with autoplay on Android after the first tap.

Thank you in advance for helping!

2

Wednesday, June 29th 2016, 11:38am

Hi,

you could also keep using the <image> for showing the video as pano and as flat image - just change the image.hfov and view settings (and the video source if required).

Here an (animated) example for such changes - do a right click and select 'flat view' and then 'normal view':
http://krpano.com/examples/119/krpano.ht…o/videopano.xml

Best regards,
Klaus