Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad html5 video with NO controls?

Tags:

This has been killing me all day, but I am not sure how to get a html5 video player working without the native controls.

I want no controls what-so-ever but if I don't include them, the video does not seem to want to play, even if I add some javascript below trying to force it to play, it works on iPhone and multiple browsers, but not iPad which is strange, any idea?

Here's some markup if it helps!

<video src="video.mp4" id="video" poster="image.jpg" onclick="this.play();"/></video>  $('#video').click(function(){    document.getElementById('video').play(); }); 
like image 816
user1370288 Avatar asked Jun 01 '12 19:06

user1370288


People also ask

Does Safari support HTML5 player?

Safari supports the <video> and <audio> media elements on iOS 3.0 and later and in Safari 3.1 and later on the desktop (Mac OS X and Windows). Support for these media elements allows Safari and other HTML5-compliant browsers to play the indicated source media without using a plug-in.

Why is my video not working in HTML5?

If your browser error "HTML5 video file not found", it means that your browser is not up to date or website pages does not have a suitable video codec. It would help if you communicated with the developer to solve the issue and install all the required codecs.


1 Answers

iOS does not support the autoplay attribute of the video tag. It would also appear that you cannot use jQuery to bind to a click event from the video element (see fiddle).

A workaround is to position an invisible div over the video element and bind the click which plays the video to that (see fiddle):

HTML:

<div id="video-overlay"></div> <video id="video" width="400" height="300">       <source id='mp4'         src="http://media.w3.org/2010/05/sintel/trailer.mp4"         type='video/mp4'>       <source id='webm'         src="http://media.w3.org/2010/05/sintel/trailer.webm"         type='video/webm'>       <source id='ogv'         src="http://media.w3.org/2010/05/sintel/trailer.ogv"         type='video/ogg'> </video> 

CSS:

#video { border: 1px solid black; } #video-overlay { position: absolute; width: 400px; height: 300px; z-index: 999;  } 

jQuery:

$('#video-overlay').click(function(){    document.getElementById('video').play(); }); 
like image 152
net.uk.sweet Avatar answered Oct 05 '22 01:10

net.uk.sweet