HTML5 Audio <audio>

Source: Internet
Author: User

The HTML5 provides the standard for playing audio.

One, the audio on the Web

Until now, there is still no standard for playing audio on a Web page.

Today, most audio is played through plugins (such as Flash). However, not all browsers have the same plugin.

HTML5 provides a standard way to include audio through the sound element.

The audio element can play a sound file or audio stream.

Ii. Use of audio tags

<src= "Song.ogg"  controls= "Controls">  </audio>

The control property is used to add play, pause, and volume controls.

The content inserted between <audio> and </audio> is displayed for browsers that do not support the audio element:

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "Utf-8" />        <title></title>    </Head>    <Body>        <Divstyle= "Text-align:center;">            <VideoID= "Video1"width= "420"style= "margin-top:55px;">                <Sourcesrc= "Img/mov_bbb.mp4"type= "Video/mp4" />                <Sourcesrc= "Img/mov_bbb.ogg"type= "Video/ogg" />Your Browser does not support HTML5 video. </Video>            <BR/>            <Buttononclick= "Playpause ()">Play/Pause</Button>            <Buttononclick= "Makebig ()">Big</Button>            <Buttononclick= "Makenormal ()">In</Button>            <Buttononclick= "Makesmall ()">Small</Button>            <BR/>            <BR/>            <AudioControls= "Controls">                <Sourcesrc= "Img/qiuyinong.mp3"type= "Audio/mpeg">Your Browser does not support the audio tag. </Audio>        </Div>        <Scripttype= "Text/javascript">            varMyvideo=document.getElementById ("Video1"); functionPlaypause () {if(myvideo.paused) myvideo.play (); ElseMyvideo.pause (); }            functionMakebig () {myvideo.width= 560; }            functionMakesmall () {myvideo.width=  the; }            functionMakenormal () {myvideo.width= 420; }        </Script>    </Body></HTML>

Folder Contents

1. Under Chrome Browser:

2. Under IE9 Browser:

3, IE8 browser under test:

HTML5 Audio <audio>

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.