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

an autoplay workaround for ipad works but only after adding a code I don't understand.


Hi.

I've been recently working on compatibility with i devices when streaming.

I heard autoplay didn't work on ipad and yet I had seen some websites doing it.

I googled and found a tick, and it was a simple js like this:

window.onload=function{
jwplayer().load();
jwplayer().play();
};

it worked for ff, safari, and chrome but not ie nor my ipad.

after adding some random codes, I changed it to this:
window.onload=setTimeout(function(){
jwplayer("mediaplayer").load();
jwplayer("mediaplayer").play();
}, 200);

and it worked a magic. it worked for every browser but still ipad wouldn't budge.

And here is the weird thing.
when i changed the time value from 200 to 2000,
it started autoplaying on ipad.
(btw, a video tag works fine using the first coding without the help of settimeout.)


Now that I got autoplay working, I wanted to get rid of this 2 sec wait, and having no idea where to start I've come here to get help.



my quetions are:
1.what was preventing ipad browser from loading and playing in the first and second codings?
2.why does jwplayer need settimeout to make it happen on ipad, while the video tag doesn't?

thanks in advance ;)




1 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

That is not going to work…apple checks for these types of things. You really can’t autostart videos on iOS…

This question has received the maximum number of answers.