Background video does not play on mobile?

前端 未结 3 940
南旧
南旧 2021-01-01 07:13

I\'ve made a landing page where video plays at the background of a form.
It\'s working fine on desktops but I checked on my Android device using Chrome, the background v

3条回答
  •  误落风尘
    2021-01-01 08:06

    You need a couple more attributes for your video element

    Safari and Chrome for mobile made changes on how video on mobile acts. By default, it can only autoplay when the video is muted. But for webkit/iOs you also need a second attribute; playsinline. This attribute makes it so that it plays inline, rather than jumping to fullscreen video.

    Also make sure your mobile devices are not running in Low Power Mode if you’re targeting iOS 11. If you’re on Chrome For Android, Data Saver mode will also prevent auto play and thus won't show the video. There's not anyway around this.

提交回复
热议问题