I have used Youtube API to play automatically a video but i have found out that it only works fine on PCs but NOT mobile devices. I did a bit of google-ing and discovered that autoplay feature is disabled on mobile devices.
No the questions is, can i detect if autoplay is disabled ??. Or at least force the video to show youtoube play button if vidio is on state -1.
i.e.
if(event.data == -1) {
// show play button
}
A sample to autoplay without using arg
autoplay
. I only test this solution on PCs not mobile but you can try this code :LIVE EXAMPLE
HTML
JS
It appears that there is no way of getting this information without testing with you video and checking whether the video's current time has advanced after it has loaded.
It was asked for as a feature in modernizr but as you can see from this comment from Paul Irish, you have to have a video to check. It looks like they are trying to add this into v3 of modernizr.
So essentially it is doable and his pseudocode should get you started. Basically the first four points are done already. You would just need to implement the last two.