开发者

Type of the source attribute for video in HTML 5

I just have a quick question. I'm experimenting with the video tag in HTML5 and there is something that I can;t quite understand. First let me say that the video plays fine, tested FF, Chrome, Opera and Safari and it works just fine, but when I try to validate the pa开发者_Go百科ge with the HTML5 validator, it throws an error. I use the validator as a guideline, just to check for errors and help me write better code.

This is the error I get:

Bad value video/webm; codecs='vp8, vorbis' for attribute type on element source: Expected a token character, whitespace or a semicolon but saw , instead.
src="../video/test.webm" type="video/webm; codecs='vp8, vorbis'" />

And I get this error for each type of video format I'm using.

However, while reading on this page, 4.8.6 The video element — HTML5 , it seems that I'm doing things right.

Like I said I don't rely on the validator other than to help me see errors in my code, but I'm wondering if I'm missing something here, or is it because the validator is still experimental.

Thanks everybody!


Try changing your type from this:

type="video/webm; codecs='vp8, vorbis'"

to this

type='video/webm; codecs="vp8, vorbis"'

EDIT

While checking the HTML5 spec for the source element, the way I state above is how it is defined in the spec. If you are still getting validation errors I would assume it is a bug with the validator. I'd submit a bug report here so that it will get fixed.


<source type='video/webm; codecs="vp8, vorbis"' src="media/video.webm" />

You can use single quotes for the type attribute and the double quotes for the codecs value. This is valid and it doesn't harm your document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜