Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting currentTime on HTML5 video tag on ipad

I'm writing a jQuery plugin for the video tag on the ipad. One of the things my plugin does is resumes playing a movie where you last quit watching it. I'm having issues setting current time. I've found I can only set it after the "stalled" event has fired. The stalled seems to fire on an ipad after a movie starts playing (this is an HTTP live stream video). I don't see this event in other environments i.e. google chrome on a PC. So this code works but I feel uncomfortable using the stalled event. I've tried canplaythrough, playing and others and in those cases my update to currentTime is ignored. Does anyone else have experience with this?

var theClass = this;
$(this.videoElement).bind("pause play stalled error abort progress waiting playing webkitfullscreenchange canplaythrough", null, function (e) {
    ///<summary>bind to the various events we are interested in during playback.  event state changes will be saved to
    ///local storage.  If we detect the media has finished playing we will exit fullscreen and trigger our mediaDone event</summary>
    if (e.type == "stalled" && theClass.resumeTriggered) {
        theClass.resumeTriggered = false;
        theClass.resumeTime = theClass.resumeTime + 0.1;

        $("#smpPlayerDebug").append("<p> seeking to time " + theClass.resumeTime + "</p>");
        e.srcElement.currentTime = theClass.resumeTime;
    }
like image 704
user1086391 Avatar asked Nov 13 '22 13:11

user1086391


1 Answers

It just plain doesn't work. The iPad's support for controlling video play is weak, probably in Apple's attempt to create a standard experience (not allowing too much variation).

like image 157
Brett Holt Avatar answered Nov 16 '22 03:11

Brett Holt