Home  >  Article  >  Web Front-end  >  Audio element in HTML5

Audio element in HTML5

黄舟
黄舟Original
2016-12-22 15:32:281638browse

HTML 5 provides a standard for playing audio.

Audio on the Web

Until now, there was still no standard that aimed at playing audio on web pages. Today, most audio is played through plug-ins (such as Flash). However, not all browsers have the same plugins. HTML 5 specifies a standard way to include audio through the audio element. The audio element can play sound files or audio streams.


HTML5 supported audio formats

Currently, the audio element supports three audio formats:

Audio element in HTML5

How does it work?

To play audio in HTML 5, all you need is:

<audio src="song.ogg" controls="controls"> </audio>

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

The above is the content of the audio element in HTML5. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Video element in HTML5Next article:Video element in HTML5