Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Obtaining duration before playback


I saw some older articles referring to this, but I couldn't find anything that works.
http://support.jwplayer.com/customer/portal/questions/6062969-get-video-duration

I am trying to obtain the duration of the video prior to playback, which I would then send to the database.
Is it because the new version? (I have a paid version 7.0.0)

I tried using this:

events:{
onReady: function() {
this.play();
this.pause();
duration = this.getDuration();
}
}

but it never pauses.

I also tried "autostart:true" and then calling "this.pause()" in onReady, but that also doesn't work.

Here's a link:
http://mystage32.com/index2.php?task=1

1 Community Answers

Alex

JW Player Support Agent  
0 rated :

Hi, there!

You should be able to do this with JWPlayer 7 using one of the following:

jwplayer().play() and jwplayer().pause()
playerInstance.play() and playerInstance.pause() [this assumes your DIV id remains ‘playerInstance’]

You can read more about the playback setter and getters in our JavaScript API at http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference#playback.

Please let me know if you need any more help or have any other questions.

Thank you!

This question has received the maximum number of answers.