HTML audio and video tags

Source: Internet
Author: User

The audio and video tags are HTML5 tags, <audio></audio> and <video></video> respectively, and these two tag usages are approximately the same and are used only in IE9 and above and other browsers. Not supported in IE8 and in the following versions.

Usage examples:

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "Utf-8">    </Head>    <Body>        <Videowidth= "400px"Height= "400px"AutoPlay= "AutoPlay"Controls= "Controls">            <Sourcesrc= "D4.mp4"type= "Video/mp4">your browser does not support the HTML5 video tag. </Video>        <AudioLoop= "Loop"Controls= "Controls"preload= "Auto">            <Sourcesrc= "D1.mp3"type= "Audio/mp3">your browser does not support the HTML5 audio tag. </Audio>    </Body></HTML>

The text in the previous example, "Your browser does not support HTML5 Audio/video tags", is only displayed if the browser is not compatible with the label and the tag does not take effect.

<audio></audio> and <video></video> the majority of the properties of the two tags are the same, as follows:
AutoPlay If this property appears, the video plays as soon as it is ready.
Preload if this property appears, the video loads when the page loads and prepares to play. If you use "autoplay", the property is ignored.
Controls if this property appears, the control is displayed to the user, such as the play button.
Loop If this property occurs, the media file starts playing again when it finishes playing.
Muted if this property appears, the audio output of the video is muted.
Poster Specifies that the video is being downloaded when the image is displayed until the user clicks the play button.
SRC The URL of the video to play.

In addition to the,<video></video> tag, you can also set the width and Height properties.

Audio and video files are best mp3, MP4 files, because only these two files are compatible with all versions of the browser.

HTML audio and video tags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.