You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **`<audio>`**[HTML](/en-US/docs/Web/HTML) element is used to embed sound content in documents. It may contain one or more audio sources, represented using the `src` attribute or the {{HTMLElement("source")}} element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a {{domxref("MediaStream")}}.
9
+
The **`<audio>`**[HTML](/en-US/docs/Web/HTML) element is used to embed sound content in documents. It may contain one or more audio sources, represented using the `src` attribute or the {{HTMLElement("source")}} element: the browser will choose the most suitable one.
10
+
It can also be the destination for streamed media, using a {{domxref("MediaStream")}}.
The above example shows basic usage of the `<audio>` element. In a similar manner to the {{htmlelement("img")}} element, we include a path to the media we want to embed inside the `src` attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc.
28
+
The above example shows basic usage of the `<audio>` element.
29
+
In a similar manner to the {{htmlelement("img")}} element, we include a path to the media we want to embed inside the `src` attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc.
28
30
29
31
The content inside the opening and closing `<audio></audio>` tags is shown as a fallback in browsers that don't support the element.
30
32
@@ -36,7 +38,10 @@ This element's attributes include the [global attributes](/en-US/docs/Web/HTML/R
36
38
- : A Boolean attribute: if specified, the audio will automatically begin playback as soon as it can do so, without waiting for the entire audio file to finish downloading.
37
39
38
40
> [!NOTE]
39
-
> Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control. See our [autoplay guide](/en-US/docs/Web/Media/Guides/Autoplay) for additional information about how to properly use autoplay.
41
+
> Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
42
+
> If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it).
43
+
> However, this can be useful when creating media elements whose source will be set at a later time, under user control.
44
+
> See our [autoplay guide](/en-US/docs/Web/Media/Guides/Autoplay) for additional information about how to properly use autoplay.
40
45
41
46
-`controls`
42
47
- : If this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback.
@@ -83,165 +88,48 @@ This element's attributes include the [global attributes](/en-US/docs/Web/HTML/R
- : The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
- : The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the {{domxref("HTMLMediaElement.load")}} method is called to reload it.
0 commit comments