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

Callback for on autostart not allowed


Hi there

There are more and more browsers which doesn't allow autostart. Is there something to check, if autostart is allowed or not? Lika a "onAutostartDisallowed" callback?

My current workaround is to check the players state on ready (for example, Chrome on Android doesn't fire any requests at all in the first place) ...

// on('ready')
window.setTimeout(function() {
if (jwplayer('id').getState() === 'idle') {
// Do something smart here
}
}, 0);

... and onAdImpression (for example, Safari 11 requesting the ad before pausing the autostarted stream)

// on('adImpression')
window.setTimeout(function() {
if (jwplayer('id').getState() !== 'playing') {
// do something smart here
}
}, 0);

Is there a better, cleaner way to do this? Or is there even a feature planed?

Thank you.
Cheers, Marc

5 Community Answers

Todd

JW Player Support Agent  
1 rated :

Interesting question. I am not aware of which event might bubble up if an autostart attempt is suppressed by the browser, but let me check with our product manager and get back to you.

Marc

User  
0 rated :

Hi Todd

Any news about this?

Todd

JW Player Support Agent  
0 rated :

I have not seen any updated documentation for this, but I will update you when it is available.

Todd

JW Player Support Agent  
0 rated :

Hi Marc,

JW8 has an on(‘playAttemptFailed’) event handler that can be used to detect these scenarios. Please see our updated Javascript API documentation at https://developer.jwplayer.com/jw-player/docs/javascript-api-reference/#jwplayeronplayattemptfailed for more details.

Hope this helps. Please let me know if you have any other questions,
Todd

Marc

User  
0 rated :

Hi Todd

Thank you! This is exactly what we were looking for.

This question has received the maximum number of answers.