简体   繁体   中英

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 ie 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;
    }

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM