HTML5 video background on iPad/iphone

后端 未结 8 671
故里飘歌
故里飘歌 2021-01-30 18:36

I used this solution to use an html5 video as the background of my site.

However, it doesn\'t seem to work on iPad/iphone, all I am getting is a black screen, and the vi

8条回答
  •  死守一世寂寞
    2021-01-30 19:06

    The only way to autoplay videos on mobile devices is to ditch the html video tag.

    I see three options, assuming you don't need audio:

    • Use a gif instead of the video. Depending of the animation, the file size will skyrocket though
    • Use a really long jpg or png that contains every frame of the video and then shift through them with javascript
    • Decode the video with javascript. For example use this h.264 decoder and play videos with good compression. Only downside I see is that it requires quite some CPU for the decoding.

    I went for the last solution and it works fine.

提交回复
热议问题