Kumar
Kumar

Reputation: 277

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 ?

Upvotes: 9

Views: 6811

Answers (2)

Thomas M
Thomas M

Reputation: 65

Try this. Note replace videoLink with the embed URL from YouTube.

src=//videoLink?autoplay=1

Upvotes: 0

Graham Swan
Graham Swan

Reputation: 4828

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>

Upvotes: 1

Related Questions