Using HTML5 on iPhone - cannot pause
        Posted  
        
            by Ariel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ariel
        
        
        
        Published on 2010-04-18T11:15:36Z
        Indexed on 
            2010/04/18
            11:23 UTC
        
        
        Read the original article
        Hit count: 396
        
Hey guys,
I was wondering whether anyone has tried to use the new tag that comes with HTML5 on the iPhone. Specifically, I didn't manage to make the pause() command to work. Below is a portion of the page. As you can see, I'm trying to pause the video 10sec after it started. It works on Safari on a Mac btw. Has anyone managed to make this work?
<head>
<javascript language="JavaScript">
function timeUpdate()
{
 var myVideo = document.getElementsByTagName('video')[0];
 var time = myVideo.currentTime;
 if (time > 10)
 {
  myVideo.pause();
 }
}
function addListeners()
{
 var myVideo = document.getElementsByTagName('video')[0];
 myVideo.addEventListener('timeupdate',timeUpdate,false);
}
</script>
</head>
<body onload="addListeners()">
 <video controls src="resources/bb_poor_cinderella_512kb.mp4" 
  poster="resources/background.png">
  Video tag not supported!
 </video>
</body>
Thanks,
Ariel
© Stack Overflow or respective owner