Can you autoplay HTML5 videos on the iPad?

后端 未结 6 962
挽巷
挽巷 2020-11-22 05:14

The tags autoplay=\"autoplay\" attribute works fine in Safari.

When testing on an iPad, the video must be activated manually.

6条回答
  •  孤城傲影
    2020-11-22 06:17

    As of iOS 10, videos now can autoplay, but only of they are either muted, or have no audio track. Yay!

    In short:

    • elements will now honor the autoplay attribute, for elements which meet the following conditions:
      • elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.
      • elements will also be allowed to autoplay without a user gesture.
      • If a element gains an audio track or becomes un-muted without a user gesture, playback will pause.
      • elements will only begin playing when visible on-screen such as when they are scrolled into the viewport, made visible through CSS, and inserted into the DOM.
      • elements will pause if they become non-visible, such as by being scrolled out of the viewport.

    More info here: https://webkit.org/blog/6784/new-video-policies-for-ios/

提交回复
热议问题