HTML5 music player tag audio Application

Source: Internet
Author: User
If you still use the following: & amp; lt; EMBEDsrc = & amp; ldquo; music. mid & amp; rdquo; autostart = & amp; ldquo; true & amp; rdquo; loop = & amp; ldquo; 2 & amp; rdquo; widt

If you use the following code:
<EMBED src = "music. mid" autostart = "true" loop = "2" width = "80" height = "30">
If you play music in the form, it will be out. html5 audio can better support music playing, of course it does not support IE.
Browser support:


Browser

Support

Codecs

Chrome

3.0

Theora, Vorbis, Ogg

H.264, AAC, and MPEG4

FireFox

3.5

Theora, Vorbis, Ogg

IE

Not Supported

None

Opera

10.5

Theora, Vorbis, Ogg (10.5)

VP8, Vorbis, WebM (10.6)

Safari

3.2

H.264, ACC, MPEG4


Common control functions:


Function

Action

Load ()

Loading audio and video software

Play ()

Load and play audio and video files or play paused audio and video again

Pause ()

Pause audio and video files in the playback status

CanPlayType (obj)

Test whether a specified Mini file is supported


 

Read-Only media attributes:


Read-only attribute

Value

Duration

Gets the playback duration of a media file, in seconds. If it cannot be obtained, it is NaN.

Paused

If the media file is paused, true is returned; otherwise, false is returned.

Ended

Returns true if the media file has been played.

StartTime

Returns the start playback time.

Error

Error Code returned

CurrentSrc

Returns a file that is being played or loaded as a string.


Property values that can be controlled by script:


Attribute

Value

Autoplay

Automatically play the loaded media file

Loop

If it is true, it is set to automatic playback.

CurrentTime

Returns the time taken from the start of playback to the current time in seconds.

Controls

Show or hide the User Control Interface

Volume

Volume value, from 0.0 to 1.0

Muted

Set whether to mute

Autobuffer

Buffer loading?


Take a look at the following simple application:


    
     From PHP point-of-the-box (http://www.phpddt.com) web tutorialScript function playClicked (element) {// get the state of the playerif (audio_player.paused) {audio_player.play (); newdisplay = "|";} else {audio_player.pause (); newdisplay = ">";} element. value = newdisplay;} script 

If you remove the controls tag, the player will hide it.

Related Article

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.