最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Video won't play on Safari & Chrome mobile even with muted autoplay - Stack Overflow

programmeradmin7浏览0评论

I can't launch an autoplay video on a website on mobile, tapping won't work either.

<video width="270" height="533" id="video" autoplay muted loop>
  <source src="img/Mockup.mp4" type="video/mp4">
</video>

I also tried with

document.getElementById('video').load();

I have no clues how to fix it. Any tips ?

Thanks !

I can't launch an autoplay video on a website on mobile, tapping won't work either.

<video width="270" height="533" id="video" autoplay muted loop>
  <source src="img/Mockup.mp4" type="video/mp4">
</video>

I also tried with

document.getElementById('video').load();

I have no clues how to fix it. Any tips ?

Thanks !

Share Improve this question edited Jun 17, 2020 at 9:39 ADyson 62.2k16 gold badges79 silver badges92 bronze badges asked Jun 17, 2020 at 9:05 Pickle_RickPickle_Rick 1211 silver badge7 bronze badges 4
  • 1 any errors in the console? "won't work" isn't much in the way of useful debugging info. – ADyson Commented Jun 17, 2020 at 9:08
  • Nop no errors, by the way is there a way to inspect it with my phone ? – Pickle_Rick Commented Jun 17, 2020 at 9:12
  • Yes. developers.google./web/tools/chrome-devtools/… – ADyson Commented Jun 17, 2020 at 9:17
  • 1 Well, just figured it out. There was no problem on Android so I had to add playsinline and now it works fine ! – Pickle_Rick Commented Jun 17, 2020 at 9:24
Add a ment  | 

1 Answer 1

Reset to default 5

For anyone interested for Ios you have to add playsinline inside your video tag to make it works. See there : HTML5 Video autoplay on iPhone

Cheers !

发布评论

评论列表(0)

  1. 暂无评论