HTML5 Video Element on iPad doesn't fire onclick?

Posted by bhups on Stack Overflow See other posts from Stack Overflow or by bhups
Published on 2011-01-11T05:15:16Z Indexed on 2011/02/21 23:24 UTC
Read the original article Hit count: 197

I am using the video element in my HTML as following:

<div id="container" style="background:black; overflow:hidden;width:320px;height:240px">
<video style="background:black;display:block" id="vdo" height="240px" width="320px" src="http://mydomain/vid.mp4"></video></div>
And in javascript I am doing this:
var video=document.getElementById('vdo');
var container=document.getElementById('container');
video.addEventListener('click', function(e) {
  e.preventDefault();
  console.log("clicked");
}, false);
container.addEventListener('click', function(e) {
  e.preventDefault();
  console.log("clicked");
}, false);
On desktop safari/chrome everything is working fine. I can see two "clicked" in the console. But on ipad there is nothing. First I tried with iOS versin 3.2, then I updated it to the latest one 4.2.1 without any success.
I found a similar question HTML5 Video Element on iPad doesn't fire onclick or touchstart events? where it suggests not to use controls in video tag and I am not using it.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about events