Robert Fleming
Robert Fleming

Reputation: 145

HTML5 video tag autoplay on ios6 / Safari

I'm attempting to build a site that will autoplay short videos (.mov) on a rotating basis. Seemed okay to HTML5 and works well with Chrome on a PC. But when running on an iPad, the video does not autoplay, and waits for someone to click the video. Is there not a way to autoplay? I've attempted to invoke via javascript, but it fails. Any suggestions are welcome. I've confirm ios6.01 on iPad2..

The tag is as follows:

    <video id="vidWindow" controls="controls"
           autoplay="autoplay"  poster="images/rbc3d.png">
        <source src="videos/28497184.mp4"   />
            Your browser does not support the video tag.
    </video>

Upvotes: 1

Views: 4176

Answers (2)

KiranYNG
KiranYNG

Reputation: 41

Just add 'webkit-playsinline' attribute to the video tag and execute the below javacript function

function playVideo(){
   var video = document.getElementById("vidWindow");
   video.play();
}
playVideo();

Upvotes: 1

Zorro
Zorro

Reputation: 11

This was intentionally disabled by Apple (and for good reason). The Safari Reference Library states:

In Safari on iPhone OS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, autobuffering and autoplay are disabled. No data is loaded until the user initiates it. This means the JavaScript play() and load() methods are also inactive until the user initiates playback, unless the play() method is triggered by user action.

Upvotes: 1

Related Questions