html5 autoplay video in Mobile device

前端 未结 8 646
南方客
南方客 2020-12-06 00:45

Auto play is not working without muted attribute, when I try to open url in mobile device. How to play video without using muted attribute

8条回答
  •  情话喂你
    2020-12-06 01:35

    You wont be able to achieve this in iOS without hacks. From the official Apple WebKit documentation:

    Starting in iOS 10, WebKit relaxes its inline and autoplay policies to make these presentations possible, but still keeps in mind sites’ bandwidth and users’ batteries.

    By default, WebKit will have the following policies:

    • video elements will be allowed to autoplay without a user gesture if their source media contains no audio tracks.
    • video muted 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.

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

    As for Mobile Chrome (Android):

    Muted autoplay for video is supported by Chrome for Android as of version 53. Playback will start automatically for a video element once it comes into view if both autoplay and muted are set, and playback of muted videos can be initiated progamatically with play(). Previously, playback on mobile had to be initiated by a user gesture, regardless of the muted state.

    https://developers.google.com/web/updates/2016/07/autoplay

提交回复
热议问题