HTML5 视频自动播放无法正常工作 [英] HTML5 Video Autoplay not working correctly
问题描述
我正在使用此代码:
<video width="440px" loop="true" autoplay="true" controls>
<source src="http://www.example.com/CorporateVideo.mp4" type="video/mp4" />
<source src="http://www.example.com/CorporateVideo.ogv" type="video/ogv" />
<source src="http://www.example.com/CorporateVideo.webm" type="video/webm" />
</video>
我希望视频自动播放,但是当页面加载时视频不播放.看起来这是一个缓冲问题,因为当我将鼠标悬停在视频上(以显示控件)时,视频始终播放 2 秒,但随后停止并且不再继续.
I want the video to autoplay but when the page loads the video doesn't play. It looks like it's a buffering issue, as when I hover on the video (to show controls) the video is always 2 seconds in but then stops and doesn't continue.
注意:我刚刚再次访问了该站点,并且自动播放似乎可以正常工作,但是当我再次尝试时出现了同样的问题,这是缓冲问题吗?我能做些什么来阻止这种情况?
Note: I just visited the site again and autoplay seemed to work, but when I try again the same issue is happening, is this a buffering issue? Anything I can do to stop this?
推荐答案
尝试 autoplay="autoplay"
而不是 "true"
值.这是启用自动播放的记录方式.这听起来很奇怪,我知道.
Try autoplay="autoplay"
instead of the "true"
value. That's the documented way to enable autoplay. That sounds weirdly redundant, I know.
这篇关于HTML5 视频自动播放无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!