Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoplay youtube videos in android

I am trying to autoplay youtube videos on android, the same thing as in

How can I autoplay a video using the new embed code style for Youtube?

The following HTML works in google chrome browser, but not in the browser in android emulator.

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/xxxxxxxx?autoplay=1&vq=medium" frameborder="0"></iframe>

Can anyone shed light on this ?

like image 525
Kumar Avatar asked Oct 09 '10 16:10

Kumar


1 Answers

According to this answer, disabling autoplay is slowly becoming a standard in mobile browsers. This is happening to prevent unwanted sound from playing and to conserve battery.

You may want to give the method from this article a shot.

function callback () {
    document.querySelector('video').play();
}

window.addEventListener("load", callback, false);

<video poster preload="true">
    <source src="video.mp4"  type="video/mp4">
</video>
like image 160
Graham Swan Avatar answered Sep 20 '22 08:09

Graham Swan