Q: How do I manually loop an html5 video in iOS 4.3/5? I have a video that has certain segments that need to be looped.  My problem is that on iOS 5, after the third time I update videoElem.currentTime, mobile safari stops updating that attribute.
On iOS 4.3, it seems to stop working intermittently.  What is causing currentTime to break and what are some workarounds?
Btw, I've tried setting the currentTime to floats with only one decimal & I've tried to set it to >0.  Neither has yielded any success.
Sample code:
window.setInterval(startTimer, 50); //ms

// function to begin the timer
var frameNum = 0;
function startTimer() {

  frameNum++;

  if (frameNum % 5 === 0)
  {
    console.log(videoElem.currentTime);
  }

  if (videoElem.currentTime >= 7) {
    videoElem.currentTime = 1;
    videoElem.play();
  }
}


A: Add the following event listener in JavaScript ( Source ):
UPDATE: play 1 - 7 seconds in infinite loop
function restartVideo(){
    videoElem.currentTime = 0.1; //setting to zero breaks iOS 3.2, the value won't update, values smaller than 0.1 was causing bug as well.
    videoElem.play();
}
function videoTick(){
    if(videoElem.currentTime > 7) {
        restartVideo();
    }
}

// check progress every 1 second
window.setInterval(videoTick, 1000);

See demo link in iDevice : http://raptor.hk/dev/video.html
UPDATE 2: video controls of the video in demo link is removed. Still working in iOS.
