html - 在 html 中再次播放视频后循环播放 html5 视频变黑屏

标签 html css

我添加了一个代码用于将视频作为横幅播放,但面临一个问题,即每当视频播放完毕时出现黑屏并再次播放视频。

<div class="background-wrap">
  <video id="video-bg-elem" preload="auto" autoplay="true" loop="loop" muted="muted" width="100%" height="400"><source src="http://localhost/blue/wp-content/uploads/2019/03/4K_UHD_Drone_Fly_Past_Radio_Tower_Portland_Oregon_Crest_Point_Fernando-1.mp4" type="video/mp4"></video></div>

最佳答案

我已经在所有浏览器中对此进行了测试。请查看此标记中的属性,这也适用于您的情况。

  <video width="400" controls playsinline loop muted >
      <source src="https://app.coverr.co/s3/mp4/Over-the-Map.mp4" type="video/mp4">
      Your browser does not support HTML5 video.
    </video>

更新:Android 和 iOS 上较新版本的手机浏览器支持自动播放功能。但它仅在视频静音或没有音频 channel 时才有效。 :-)

有关更新部分的更多详细信息,请阅读: https://webkit.org/blog/6784/new-video-policies-for-ios/

关于html - 在 html 中再次播放视频后循环播放 html5 视频变黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55474254/

相关文章:

javascript - Firefox 中的 NS_ERROR_FAILURE 在隐藏的 iframe 中设置 Canvas 字体

css - 为什么 CSS calc() 函数对我不起作用?

html - 复选标记不显示在 Window.print Angularjs 的复选框中

internet-explorer - Internet Explorer 中的最大宽度和最大高度解决方案

php - 如何使用 php 和 html 创建行和列

html - 当文本都在同一个 li 元素中时,如何使文本从另一个文本的正下方开始

jquery - 如果图像设置为显示: none do they still load?

html - CSS:从元素本身获取边框颜色

css - 使用 base64 的带有 js 内联样式的组件背景

html - GWT 将 FlowPanel 视为 HTML 上下文 - 为什么?