HTML Video not working on mobile

后端 未结 3 1751
臣服心动
臣服心动 2020-12-18 15:09

I have a full width background video with autoplay and loop propreties and works really good on desktop but in mobile video dont show and dont start... just show a black scr

相关标签:
3条回答
  • 2020-12-18 15:36

    adding playsinline attribute to the video tag fixed the issue for me.

    according to a good google search, on mobile the Video element falls back to a poster... be mind full of video size so they user will not encore massive data usage charges and to maintain a responsive site.

    <video playsinline autoplay loop muted id="myVideo"></video>
    
    0 讨论(0)
  • 2020-12-18 15:47

    Turns out the video actually plays - but it's weird how that happens! First of all, I'm testing on Android 5.1.1. Alright, here's the situation: On load, the video doesn't play but instead displays the fallback poster image. I had given up on the video thing, but when I was navigating the site and at some point decided I wanted to go back Home, I navigated to the Homepage and the video was playing! I tried refreshing the page, and the video didn't play on load but instead got the poster image! What could be happening? I figured just clicking the phone's back button to navigate to the homepage still didn't play the video, but explicitly clicking the home link did! So I gave it another shot - refreshed the page, video didn't play, clicked the home link and the video started playing on load! This is the structure of my home link: <a href="./"><img src="path-to-logo" /></a> Can somebody explain what could be happening?

    0 讨论(0)
  • 2020-12-18 15:53

    The Autoplay tag on mobile is generally not supported - this is to avoid users incurring data transfer costs as video files are large and can eat into data limits.

    The poster tag should work fine, however, as I think you noted in your last comment.

    0 讨论(0)
提交回复
热议问题