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

jwplayer("container").getPosition(); Returning Undefined

The following code is returning undefined how do I get the following code to work on my page?

var x = jwplayer("container").getPosition();

My ultimate goal was to get the following to work

if (jwplayer("container").getPosition(); > 60) {
document.getElementById('delay').style.display = 'block';

But this is not working. I want the div to display after the video hits a certain time.

2 Community Answers


1 rated :

I have it working with an HTML 5 Video but I want to get it to work with JWPLAYER

This code works for me:
<video src="" autoplay></video>

<div id="time"></div>
var v = document.getElementsByTagName('video')[0]
var t = document.getElementById('time');
t.innerHTML = v.currentTime;
if (v.currentTime > <%=REVEALDELAY%>) {document.getElementById('delay').style.display = 'block';document.getElementById('disclaimers').style.display = 'block';document.getElementById('references').style.display = 'block';document.getElementById('whitewrap').style.display = 'block';
document.cookie = "visit=yes";};


JW Player Support Agent  
2 rated :

You have to put your

if (jwplayer(“container”).getPosition(); > 60) {
document.getElementById(‘delay’).style.display = ‘block’;

inside of an onTime() event, like this:

if (jwplayer(“container”).getPosition() > 60) {
document.getElementById(‘delay’).style.display = ‘block’;

because the onTime() is what fires every tenth of a second or so.

This question has received the maximum number of answers.