HTML5 视频缓冲区

发布于 2025-01-03 19:22:32 字数 183 浏览 0 评论 0原文

我有一个视频,我想在用户单击按钮时显示该视频。我使用 jQuery .append() 将视频代码添加到页面。

我已设置自动播放,目前,视频首先开始仅播放音频,然后过了一会儿,又从头开始播放音频和视频。

有什么办法可以防止这种故障的发生吗?

提前致谢!

I have a video that I want to show when the user clicks on a button. I add the video code to the page using jQuery .append().

I've set autoplay and currently, the video first starts to play with audio only, and then after a while, starts again from the beginning with audio and video.

Is there a way I could prevent this glitch from happening?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再见 2025-01-10 19:22:32

我遇到了同样的问题。 jQuery 正在创建您的视频元素,并在将其附加到页面之前开始播放(在后台)。当使用 .html() 而不是 .append() 制作元素时,似乎不会发生这种情况: http: //jsfiddle.net/cDpV9/6/

$("#player").html("<video id='v' src='http:...webm' autobuffer='auto' preload autoplay controls />");

I had the same issue. jQuery is creating your video element and it starts playing (in the background) before it appends it to the page. It doesn't seem to happen when making the element with .html() instead of .append(): http://jsfiddle.net/cDpV9/6/

$("#player").html("<video id='v' src='http:...webm' autobuffer='auto' preload autoplay controls />");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文