简体   繁体   English

元素视频的属性自动播放错误值true

[英]Bad value true for attribute autoplay on element video

So I am using HTML 5 to play video in the background. 因此,我正在使用HTML 5在后台播放视频。 The issue is that I am using the old way of HTML 5 does anyone know the new HTML5 way to play the video in the background however it should also display a image if on mobile. 问题是,我使用的是旧版HTML 5,没有人知道新的HTML5在后台播放视频的方法,但是如果在移动设备上,它也应该显示图像。

Here is my solution: 这是我的解决方案:

  <div class="background-wrap"> <video poster="css/style.css" id="video-bg-elem" preload="auto" autoplay="true" loop="loop" muted="muted"> <source src="video/husky.mp4" type="video/mp4"> <source src="video/husky.webm" type="video/webm"> Video not supported </video> </div> </div> 

When ever I run the validation I get the following: 每当我运行验证时,都会得到以下信息:

Error: Bad value true for attribute autoplay on element video. 错误:元素视频上的属性自动播放错误的值true。 From line 36, column 1; 从第36行第1列开始; to line 36, column 106 nd-wrap">↩↩ 到第36行,第106列nd-wrap“>↩↩

My website: https://edgaraxe.net/teamhusky/ 我的网站: https : //edgaraxe.net/teamhusky/

You don't need to specify the true value for the autoplay attribute. 您无需为autoplay属性指定true值。

<video poster="css/style.css" id="video-bg-elem" preload="auto" autoplay loop="loop" muted="muted">
      <source src="video/husky.mp4" type="video/mp4">
      <source src="video/husky.webm" type="video/webm">
      Video not supported
 </video>

This acts like the controls or required attributes. 这就像controlsrequired属性一样。 required or required="required" are both valid. requiredrequired="required"均有效。

I have validated this against the W3C for you: 我已经针对您针对W3C对此进行了验证:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM