Video and Load Scene timing issue

  • I'm trying to time video "Transitions" and am running into intermittent issues.

    http://vtour.govtour.com/vtour_preview.php?tid=3707#

    If you go to the link above and click any of the hotspots with triangles you can observe what I'm trying to do.

    When clicking on a "Transition" hotspot and going to a new scene the following should occur:

    Trace - Total Time ( Total time of the Transition ).
    Trace - Time to fire ( 3 seconds less than Total time ).
    Trace - "Load Scene NOW" ( this should fire 3 seconds prior to the end of the transition ).

    However, sometimes the Trace - "Load Scene NOW", fires immediately with the first two Trace events. Meaning the scene is loaded immediately and not 3 seconds prior to the end of the transition - The loop ends prematurely.

    I can't tell if a variable is somehow holding onto a value or what.
    Anyone care to take a gander?

    I call the action cascade with…….

    gotrans($media,$actscene,$dest_h,$dest_v);

    Here are the relevant code blocks:

    <plugin name="trans"
    url="%SWFPATH%/player/plugins/videoplayer.swf"
    visible="false" enabled="true"
    keep="true"
    zorder="0"
    align="lefttop" x="0" y="0"
    width="100%"
    height="100%"
    alpha="0.0"
    refreshrate="auto"
    buffertime="0.1"
    iscomplete="false"
    isvideoready="true"
    loop="false"
    onvideoready=""
    onvideocomplete="tween(plugin[trans].alpha,0.0,2,default,set(plugin[trans].visible,false)); closevideo();"
    pausedonstart="false"
    updateeveryframe="true"
    volume="1"
    />

    <action name="gettranstime">
    showlog(true);
    set(mytime, 0);
    set(mytime,get(plugin[trans].totaltime));
    trace('Total time=',get(mytime));
    sub(mytime, 3);
    trace('Time to fire=',get(mytime));
    set(transtime, 0);
    set(transtime,get(plugin[trans].time));
    loop(mytime GE transtime,
    set(transtime,get(plugin[trans].time));
    wait(0);
    );
    trace('Load Scene NOW');
    loadscene(%1,view.hlookat=%2&view.vlookat=%3,MERGE,BLEND(2));
    js(setPrevScene(%1));
    set(mytime, 0);
    set(transtime, 0);
    </action>

    <action name="gotrans">
    set(plugin[trans].onvideoready,gettranstime(%2,%3,%4));
    set(hotspot.enabled,false);
    plugin[trans].playvideo(%SWFPATH%/player/media/%1.mp4);
    set(plugin[trans].visible,true);
    tween(plugin[trans].alpha,1);
    </action>

  • Hi,

    this part here seems to be problematic:

    Code
    loop(mytime GE transtime,
       set(transtime,get(plugin[trans].time));
      wait(0);
      );

    the loop and wait are not though to use together,

    try using async actions like delayedcall, asyncfor or asyncloop for looping and waiting,
    e.g.

    Code
    set(waiting,true);
    asyncloop(waiting == true,
      set(transtime,get(plugin[trans].time));
      if(transtime GE mytime, 
        set(waiting,false); 
        trace('Load Scene NOW'); 
        loadscene(...); 
        ...
      );
    );

    btw - nice work! the transitions are great

    best regards,
    Klaus

  • Klaus,

    Thanks for the reply!

    By the way, your engine helped us win an award lat year...... VTour Best Virtual-Reality Innovation.
    http://adage.com/article/specia…natives/230922/


    Getting closer, but I think I've found the issue, but I just don't know how to resolve it.

    Apparently the statement:

    set(transtime,get(plugin[trans].time));


    ...is holding onto, or getting bad information.
    The first time the action cascade is fired all goes as planned.
    But on subsequent cascades when the current time of a transition is "got" some number, greater than the number needed for the loop to end is "got" and thus "LOAD PANO NOW" is fired right away.

    Is there a way to clear this info?
    Someway to "empty" the plugin of all info from the previous "play"?

    Here is an appended output to illustrate what is going on.
    I had to trace the heck out of things to expose this.....


    INFO: krpano 1.0.8.14 (build 2011-12-20)
    INFO: Flashplayer MAC 11.1.102.55 PlugIn
    INFO: registered to: VTour LLC
    INFO: start mytime =mytime
    INFO: start transtime =transtime
    INFO: Init mytime =0
    INFO: totaltime=7.566666666666666
    INFO: totaltime - 3 =4.566666666666666
    INFO: Init transtime =0
    INFO: Original Current time =0
    INFO: Current time =0
    INFO: Current time =0.067
    INFO: Current time =0.1
    ~~~~~~~~~~~~~

    INFO: Current time =4.467
    INFO: Current time =4.467
    INFO: Current time =4.5
    INFO: Current time =4.533
    INFO: Current time =4.567
    INFO: Load Scene NOW ****** End of first loop/action cascade
    INFO: start mytime =4.566666666666666
    INFO: start transtime =4.567
    INFO: Init mytime =0
    INFO: totaltime=9
    INFO: totaltime - 3 =6
    INFO: Init transtime =0
    INFO: Original Current time =7.533 ***** This should be zero, since we are playing a new transition from the beginning.
    INFO: Current time =7.533 ***** This should also be zero, since we are playing a new transition from the beginning.
    INFO: Load Scene NOW ***** Being fired right away - no loop
    INFO: start mytime =6
    INFO: start transtime =7.533
    INFO: Init mytime =0
    INFO: totaltime=6.4
    INFO: totaltime - 3 =3.4000000000000004
    INFO: Init transtime =0
    INFO: Original Current time =8.967 ***** This should be zero, since we are playing a new transition from the beginning.
    INFO: Current time =8.967 ***** This should also be zero, since we are playing a new transition from the beginning.
    INFO: Load Scene NOW ***** Being fired right away - no loop

  • Nothing too secret here.
    Other than the back-end composer I have created for putting our tours together.
    Pretty darn robust, and complicated ! The whole player ( desktop, pad-device, facebook app) / composer "package" is over 28,000 lines of code...... *w00t*

    However, if you have specific questions I'd be more than happy to reply.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!