HTML <source> tag
Examples
Audio player with two source files. Browser support it needs to select the source files (if a support is optional):
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
try it"
Browser Support
IE 9 +, Firefox, Opera, Chrome and Safari all support <source> tag.
Note: IE 8 or earlier versions of IE browsers do not support the <source> tag.
Tag definitions and instructions
<Source> tag for the media element (such as <video> and <audio>) define the property.
<Source> tag allows you to specify two video / audio files browser based on its total media type or codec support selection.
Differences between HTML 4.01 and HTML5
<Source> tag is new in HTML5 tags.
Attributes
New: HTML5 new property.
属性 | 值 | 描述 |
---|---|---|
media New | media_query | 规定媒体资源的类型,供浏览器决定是否下载。 |
src New | URL | 规定媒体文件的 URL。 |
type New | MIME_type | 规定媒体资源的 MIME 类型。 |
Global Properties
<source> tag supports HTML global properties .
Event Properties
<source> tag supports HTML event properties .