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

onPlay Firing Twice - any fix yet


Hi, I noticed another thread regarding the OnPlay function firing twice when called, and I was wondering if anyone came up with a workaround for this? I am using the function to initiate tracking with a third party, so I'm getting double hits per Play.

Any info or suggestions would be welcomed, thanks!

3 Community Answers

Todd

JW Player Support Agent  
1 rated :

Hi,

The best workaround currently available is to set a variable and check the value to suppress the fire twice behavior. There will be a better solution in an upcoming version, but no release date has been announced.

The workaround looks like this:

var runOnce = false;
jwplayer().onPlay(function(){
if (runOnce == false) {
runOnce = true;
//additional code here will only run once on play
}
});

Hope this helps,
Todd

mike.aldinger

User  
0 rated :

Thanks Todd! Will give it a shot....

Todd

JW Player Support Agent  
0 rated :

You’re welcome. Let me know how it works out for you.

This question has received the maximum number of answers.