Onvideoready, get() and set() totaltime global variable

  • I'm trying to accomplish the following:


    Onclick play video.

    When the video is 2 seconds from ending, load a new panorama.


    The parts I'm having issue with is first; "getting" the totaltime of the video, and second; getting the time ( current play position ) of the video into variables that I can access at a global level.
    If I get the first half resolved I'm sure the second will snap into place in my head.


    When I set the video plugin ( named "trans" ) onvideoready event to: onvideoready="gettranstime();" ………


    ….. referencing the action ……


    <action name="gettranstime">

    showlog(true);

    set(mytime,get(plugin[trans].totaltime));

    trace('video time=',get(mytime));

    </action>


    …. total time is "got" and the value traces as expected.


    What I'd like to be able to do here is set the video plugin ( named "trans" ) onvideoready event to: onvideoready="set(mytime,get(plugin[trans].totaltime));"

    and be able to access the variable "mytime" like….


    <action name="gettranstime">

    showlog(true);

    trace('video time=',get(mytime));

    </action>


    ….but the "mytime" variable does not seem to resolve this way ( meaning the code "set(mytime,get(plugin[trans].totaltime));" is not within the <action> ) and the value NULL is traced.


    So basically what I need to have happen is when a video is "ready" the total time is "got" and is stored in a globally accessible variable.


    Do I not understand some core concepts here? *confused*

    Is "my time" truly being set as a "Global" variable? *wacko*


    TIA for any input.

  • I am having the same issue with totaltime. It would really be helpful to find an answer. I'm still keeping an eye out :)

    Found something! how to get information on video player. SEE BELOW

    ----
    Hi,

    Quote


    Quoted

    1. how to get the video current time and total time? i don't want to use xml.

    krpano.get("any variables for times")?

    e.g. via:


    Source code
    1
    2

    krpano.get("plugin[NAME].time");
    krpano.get("plugin[NAME].totaltime");

    where NAME is the name of the plugin element inside the xml.


    Quote


    Quoted

    2. how to get the plugin class on JS ? i tried a lot of ways... but i couldn't any ways...
    because i want to know event that video play,stop,buffer,play end, play start....

    The HTML5 videoplayer plugin exposes the internal <video> DOM element via:


    Source code
    1

    krpano.get("plugin[NAME]").videoDOM

    but when changing the video state directly via that object, the krpano states might not match. Also note - when playing a new video that object might change too.

    To avoid cross-browsers problems, I would recommend using the krpano videoplayer APIs.

    Best regards,
    Klaus

  • Hi,

    something like this should works

    videoplugin

    Code
    onloaded="MakeMyTime();"
    onvideoready="delayedcall(1, 
    				set(mytime, get(plugin[video].totaltime));
    				roundval(mytime);
    				sub(mytime, 2);
    				);"

    and the makemytime action

    Code
    asyncloop(true,
    		set(_vdotime, get(plugin[video].time));
    		roundval(_vdotime);
    		if(_vdotime == mytime, trace('Cheers from Tuur'));
    	);



    Hope this helps
    Tuur *thumbsup*

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!