HTML Audio/Video DOM Reference Manual
- Previous page HTML canvas
- Next page HTML Character Set
HTML5 Video and Audio DOM Reference Manual
HTML5 DOM provides methods, properties, and events for the <audio> and <video> elements.
These methods, properties, and events allow you to use JavaScript to manipulate <audio>
and <video>
Element.
HTML5 Audio/Video Methods
Methods | Description |
---|---|
addTextTrack() | Add a new text track to the audio/video |
canPlayType() | Detect whether the browser can play the specified audio/video type |
load() | Reload the audio/video element |
play() | Start playing the audio/video |
pause() | Pause the currently playing audio/video |
HTML5 Audio/Video Properties
Properties | Description |
---|---|
audioTracks | Return the AudioTrackList object representing the available tracks |
autoplay | Set or return whether the audio/video should play immediately after loading |
buffered | Return the TimeRanges object representing the buffered parts of the audio/video |
controller | Return the MediaController object representing the current media controller of the audio/video |
controls | Set or return whether the audio/video controls (such as play/pause) should be displayed |
crossOrigin | Set or return the CORS settings of the audio/video |
currentSrc | Return the current URL of the audio/video |
currentTime | Set or return the current playback position of the audio/video (in seconds) |
defaultMuted | Set or return whether the audio/video is muted by default |
defaultPlaybackRate | Set or return the default playback speed of the audio/video |
duration | Return the current length of the audio/video (in seconds) |
Ended | Return whether the playback of the audio/video has ended |
Error | Return the MediaError object representing the audio/video error state |
loop | Set or return whether the audio/video should replay at the end |
mediaGroup | Set or return the group that the audio/video belongs to (used to connect multiple audio/video elements) |
muted | Set or return whether the audio/video is muted |
networkState | Return the current network state of the audio/video |
paused | Set or return whether the audio/video is paused |
playbackRate | Set or return the playback speed of the audio/video |
Played | Return the TimeRanges object representing the played parts of the audio/video |
Preload | Set or return whether the audio/video should be loaded after the page is loaded |
Ready state | Return the current ready state of the audio/video |
Seekable | Return the TimeRanges object representing the addressable parts of the audio/video |
Seeking | Return whether the user is searching in the audio/video |
Src | Set or return the current source of the audio/video element |
Start date | Return the Date object representing the current time offset |
Text tracks | Return the TextTrackList object representing the available text tracks |
Video tracks | Return the VideoTrackList object representing the available video tracks |
Volume | Set or return the volume of the audio/video |
HTML5 Audio/Video Events
Event | Description |
---|---|
Abort | When the loading of the audio/video has been abandoned |
Can play | When the browser can play audio/video |
Can play through | When the browser can play without pausing due to buffering |
Duration change | When the duration of the audio/video has been changed |
Emptied | When the current playlist is empty |
Ended | When the current playlist has ended |
Error | When an error occurs during the loading of the audio/video |
Loaded data | When the browser has loaded the current frame of the audio/video |
Loaded metadata | When the browser has loaded the metadata of the audio/video |
Load start | When the browser starts to look for audio/video |
Pause | When the audio/video has been paused |
Play | When the audio/video has started or is no longer paused |
Playing | When the audio/video is ready after being paused or stopped due to buffering |
Progress | When the browser is downloading audio/video |
Rate change | When the playback speed of the audio/video has been changed |
Seeked | When the user has moved/jumped to a new position in the audio/video |
Seeking | When the user starts to move/jump to a new position in the audio/video |
Stalled | When the browser tries to fetch media data but the data is not available |
Suspend | When the browser deliberately does not fetch media data |
Time update | When the current playback position has been changed |
Volume change | When the volume has been changed |
Waiting | When the video stops due to the need to buffer the next frame |
- Previous page HTML canvas
- Next page HTML Character Set