Update content for clarity and edit punctuation (#33369)
This commit is contained in:
committed by
Randell Dawson
parent
b07fac01b2
commit
05c51c762a
@@ -3,10 +3,10 @@ title: HTML5 Audio
|
|||||||
---
|
---
|
||||||
## HTML5 Audio
|
## HTML5 Audio
|
||||||
|
|
||||||
Before HTML5, audio files had to be played in a browser using a plug-in like Adobe Flash.
|
Before HTML5, audio files required a browser plug-in like Adobe Flash.
|
||||||
The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the [source](<source>) element
|
The <audio> element is used to embed sound content in HTML documents. It may contain one or more audio sources, represented using the src attribute or the [source](<source>) element.
|
||||||
|
|
||||||
The following code snippet adds an audio file with the filename `tutorial.ogg` or `tutorial.mp3`. The <source> element indicates alternative audio files which the browser may choose from. The browser will utilize the first recognized format.
|
The following code snippet adds an audio file with the filename `tutorial.ogg` or `tutorial.mp3`. The <source> element indicates alternative audio files which the browser may choose. The browser will utilize the first recognized format.
|
||||||
|
|
||||||
#### Example 1
|
#### Example 1
|
||||||
```html
|
```html
|
||||||
@@ -23,18 +23,19 @@ Your browser does not support the audio element.
|
|||||||
</audio>
|
</audio>
|
||||||
```
|
```
|
||||||
|
|
||||||
The `controls` attribute includes audio controls like play, pause, and volume. If you don't use this attribute, then no controls will be shown.
|
The `controls` attribute includes audio controls like play, pause, and volume. If you do not use this attribute, then no controls will be shown.
|
||||||
|
|
||||||
The `<source>` element enables you to indicate alternative audio files which the browser may choose from. The browser will utilize the first recognized format.
|
The `<source>` element enables you to indicate alternative audio files which the browser may choose from. The browser will utilize the first recognized format.
|
||||||
The text between the `<audio>` and `</audio>` tags may be shown in browser that does not support the HTML5 `<audio>` element.
|
|
||||||
|
|
||||||
The autoplay attribute will automatically play your audio file in the background. It is considered better practice to let visitors choose to play audio.
|
The text between the `<audio>` and `</audio>` tags may be shown in a browser that does not support the HTML5 `<audio>` element.
|
||||||
|
|
||||||
|
The autoplay attribute will automatically play your audio file in the background. It is better practice to let users choose to play audio.
|
||||||
|
|
||||||
The preload attribute indicates what the browser should do if the player is not set to autoplay.
|
The preload attribute indicates what the browser should do if the player is not set to autoplay.
|
||||||
|
|
||||||
The loop attribute will play your audio file in a continuous loop if mentioned.
|
The loop attribute will play your audio file in a continous loop if mentioned.
|
||||||
|
|
||||||
Since this is html5, some browsers do not support it. You can check it at https://caniuse.com/#search=audio
|
Some browsers do not support HTML5. Find out here: https://caniuse.com/#search=audio
|
||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
https://caniuse.com/#search=audio
|
https://caniuse.com/#search=audio
|
||||||
|
Reference in New Issue
Block a user