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.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

1

Wednesday, October 19th 2011, 7:36pm

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.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

2

Monday, December 5th 2011, 9:17pm

I'm bumping this because I'm back to tackling this issue and still am canvasing for advice on this one....

3

Tuesday, March 1st 2016, 11:38am

I'm bumping this because I'm back to tackling this issue and still am canvasing for advice on this one....
I am having the same issue with totaltime. It would really be helpful to find an answer. I'm still keeping an eye out :)

4

Tuesday, March 1st 2016, 11:51am

I'm bumping this because I'm back to tackling this issue and still am canvasing for advice on this one....
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,

Quoted


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.


Quoted


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

Tuur

Sage

Posts: 3,184

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

5

Tuesday, March 1st 2016, 12:16pm

Hi,

something like this should works

videoplugin

Source code

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


and the makemytime action

Source code

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


Hope this helps
Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur