javascript - HTML5 Video Element on iPad doesn't fire onclick or touchstart events? -
i'm trying attach events html5 video element inside ipad web app don't seem firing? i've tested both on device , in simulator , same results. events (for onclick @ least) work fine in desktop safari. i've tried swapping video element div , events fire fine? has else come across , have idea work around?
<html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>test video swipe</title> </head> <body> <video src='somevid.mp4' id='currentlyplaying' width='984' height='628' style='background-color:#000;' controls='controls'></video> <script> var thevid = document.getelementbyid("currentlyplaying"); thevid.addeventlistener('touchstart', function(e){ e.preventdefault(); console.log("touchstart"); }, false); thevid.addeventlistener('click', function(e){ e.preventdefault(); console.log("click"); }, false); thevid.addeventlistener('touchmove', function(e){ console.log("touchmove"); }, false); thevid.addeventlistener('touchend', function(e){ console.log("touchend"); }, false); thevid.addeventlistener('touchcancel', function(e){ console.log("touchcancel"); }, false); </script> </body> </html>
the video element, on ipad, swallow events if use controls attribute. have provide own controls if want element respond touch events.
Comments
Post a Comment