HTML5 video seeking on iPad

前端 未结 4 719
小蘑菇
小蘑菇 2021-02-05 08:19

I have an HTML5 video player with a custom seek bar, that\'s working great on the iPhone (playing inline) and on the browser.

It plays great on the iPad too and the seek

4条回答
  •  囚心锁ツ
    2021-02-05 08:46

    Kyle's answer is a good one. I would add, you can't assume the seekable attribute is filled in after any particular event. This means you can't wait for events like loadedmetadata, canplay, or any other and assume that you're able to set currentTime safely at that point.

    It seems the safest way to do it is to check seekable after every video-related event, and if it encompasses the time you want to seek to, set currentTime at that point. On iPad, seekable may not be filled until after the canplaythrough event, which is quite late.

    See my blog post for more on this.

提交回复
热议问题