What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » JavaScript: FlowPlayer::getTime()

JavaScript: FlowPlayer::getTime()
Author: Message:
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. JavaScript: FlowPlayer::getTime()
I have a question related to JavaScript in general.

I see in the tutorial that users can get the playing time of the video that is playing using getTime().

<a href="javascript: getTime()">Get time</a> <input type="text" id="time" />

Basically, it calls the FlowPlayer's getTime() routine everytime a user clicks the link, then output it to the field.
My question is, how to keep executing getTime() while the video is running?

I have tried while(true) getTime();, but it didn't work.

code:
function getTime() {
    var time = flowPlayer1.getTime();
    var timeField = document.getElementById("time");
    timeField.value = time;
}

Thank you.
Registered 7853 days, 20 hours, 52 minutes, 12 seconds ago.
Happy Birthday, WDZ

04-03-2007 08:13 PM
Profile PM Find Quote Report
hmaster
Senior Member
****

Avatar

Posts: 716
Reputation: 24
33 / Male / Flag
Joined: Nov 2004
RE: JavaScript: FlowPlayer::getTime()
Have you defined flowplayer1?
My mistake didn't read the question properly.

This post was edited on 04-03-2007 at 08:47 PM by hmaster.
[Image: sig.png]
04-03-2007 08:43 PM
Profile PM Web Find Quote Report
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. RE: JavaScript: FlowPlayer::getTime()
I have.
However, I did that in a separate .js file.
But I don't think I need to re-initialize it again.

If I haven't, <a href="javascript: getTime()">Get time</a> <input type="text" id="time" /> would not work :p

Or, maybe, I don't fully understand the scope :p

This post was edited on 04-03-2007 at 08:49 PM by Weyzza.
Registered 7853 days, 20 hours, 52 minutes, 12 seconds ago.
Happy Birthday, WDZ

04-03-2007 08:45 PM
Profile PM Find Quote Report
hmaster
Senior Member
****

Avatar

Posts: 716
Reputation: 24
33 / Male / Flag
Joined: Nov 2004
RE: JavaScript: FlowPlayer::getTime()
You just want it to keep executing getTime();?
code:
x = 1;
while(x == 1) {
getTime();
}
You can also add when the video is finished not to execute.
code:
x = 1;
while(x == 1) {
     if(flowplayer1.stopped == true) { *
          x = 0;
     } else {
          getTime();
     }
}

* Not the correct code but you get the idea.

This post was edited on 04-03-2007 at 08:52 PM by hmaster.
[Image: sig.png]
04-03-2007 08:49 PM
Profile PM Web Find Quote Report
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. RE: RE: JavaScript: FlowPlayer::getTime()
Bah, you really need to read my post carefully :p
quote:
Originally posted by hmaster
You just want it to keep executing getTime();?
code:
x = 1;
while(x == 1) {
getTime();
}

I have said I did
code:
while(true) getTime();
and it didn't work.
quote:
You can also add when the video is finished not to execute.
code:
x = 1;
while(x == 1) {
     if(flowplayer1.stopped == true) { *
          x = 0;
     } else {
          getTime();
     }
}

Apparently, there's routine for checking if the video is stopped.
But getTime() will simply return 0 (seconds) if the video is stopped.
Registered 7853 days, 20 hours, 52 minutes, 12 seconds ago.
Happy Birthday, WDZ

04-03-2007 09:04 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: JavaScript: FlowPlayer::getTime()
:-/ You don't need to update it constantly... that would cause massive lag... :p

Just call the getTime() function once onload, then set a timer within the function...

setTimeout('getTime()', 1000);
04-03-2007 09:08 PM
Profile PM Web Find Quote Report
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. RE: JavaScript: FlowPlayer::getTime()
OK,

Using your idea, it prints "0" in the beginning of the video now (which is good, because it didn't before :tongue:), but it does not update :sad:

I don't think I have told the idea of this whole thing.
I want to get access to the time counter from FlowPlayer to JavaScript.
The only way I can think of is by constantly monitoring the time.
For example, at 1m 35s, I want to insert something to the page using JavaScript, etc.
Registered 7853 days, 20 hours, 52 minutes, 12 seconds ago.
Happy Birthday, WDZ

04-03-2007 09:41 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: JavaScript: FlowPlayer::getTime()
use setInterval, not setTimeout. (same parameters)
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
04-03-2007 09:42 PM
Profile PM Web Find Quote Report
Weyzza
Veteran Member
*****

Avatar
SoCal sunset > *

Posts: 1170
Reputation: 29
– / Male / –
Joined: May 2003
O.P. RE: JavaScript: FlowPlayer::getTime()
Thanks, ShawnZ.
It works :p
Registered 7853 days, 20 hours, 52 minutes, 12 seconds ago.
Happy Birthday, WDZ

04-03-2007 09:47 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On