HTML Audio and Video DOM Reference
HTML Audio/Video Methods
The HTML5 DOM has methods, properties, and events for the <audio> and <video>elements.
Method | Description |
---|---|
addTextTrack() | This method is used to adds a new text track to the audio/video. |
canPlayType() | This method is used to checks if the browser can play the specified audio/video type. |
load() | This method is used to re-loads the audio/video element. |
play() | This method is used to starts playing the audio/video. |
pause() | This method is used to pauses the currently playing audio/video. |
Property | Description |
audioTracks | This property returns an AudioTrackList object representing available audio tracks. |
autoplay | This property sets or returns whether the audio/video should start playing as soon as it is loaded. |
buffered | This property returns a TimeRanges object representing the buffered parts of the audio/video |
controller | This property returns the MediaController object representing the current media controller of the audio/video |
controls | This property rets or returns whether the audio/video should display controls. |
crossOrigin | This property sets or returns the CORS settings of the audio/video. |
currentSrc | This property returns the URL of the current audio/video. |
currentTime | This property sets or returns the current playback position in the audio/video (in seconds). |
defaultMuted | This property sets or returns whether the audio/video should be muted by default. |
defaultPlaybackRate | This property sets or returns the default speed of the audio/video playback. |
duration | This property returns the length of the current audio/video. |
ended | This property returns whether the playback of the audio/video has ended or not. |
error | This property returns a MediaError object representing the error state of the audio/video. |
loop | This property sets or returns whether the audio/video should start over again when finished. |
mediaGroup | This property sets or returns the group the audio/video belongs to link multiple audio/video elements. |
muted | This property sets or returns whether the audio/video is muted or not. |
networkState | This property returns the current network state of the audio/video. |
paused | This property returns whether the audio/video is paused or not. |
playbackRate | This property sets or returns the speed of the audio/video playback. |
played | This property returns a TimeRanges object representing the played parts of the audio/video. |
preload | This property sets or returns whether the audio/video should be loaded when the page loads. |
readyState | This property returns the current ready state of the audio/video. |
seekable | This property returns a TimeRanges object representing the seekable parts of the audio/video. |
seeking | This property returns whether the user is currently seeking in the audio/video. |
src | This property sets or returns the current source of the audio/video. |
startDate | This property returns a Date object representing the current time offset. |
textTracks | This property returns a TextTrackList object representing the available text tracks. |
videoTracks | This property returns a VideoTrackList object representing the available video tracks. |
volume | This property sets or returns the volume of the audio/video. |
Event | Description |
abort | This event run when the loading of an audio/video is aborted. |
canplay | This event run when the browser can start playing the audio/video. |
canplaythrough | This event run when the browser can play through the audio/video without stopping for buffering. |
durationchange | This event run when the duration of the audio/video is changed. |
emptied | This event run when the current playlist is empty. |
ended | This event run when the current playlist is ended. |
error | This event run when an error occurred during the loading of an audio/video. |
loadeddata | This event run when the browser has loaded the current frame of the audio/video. |
loadedmetadata | This event run when the browser has loaded meta data for the audio/video. |
loadstart | This event run when the browser starts looking for the audio/video. |
pause | This event run when the audio/video has been paused. |
play | This event run when the audio/video has been started or is no longer paused. |
playing | This event run when the audio/video is playing after having been paused or stopped for buffering. |
progress | This event run when the browser is downloading the audio/video. |
ratechange | This event run when the playing speed of the audio/video is changed. |
seeked | This event run when the user is finished moving/skipping to a new position in the audio/video. |
seeking | This event run when the user starts moving/skipping to a new position in the audio/video. |
stalled | This event run when the browser is trying to get media data, but data is not available. |
suspend | This event run when the browser is intentionally not getting media data. |
timeupdate | This event run when the current playback position has changed. |
volumechange | This event run when the volume has been changed. |
waiting | This event run when the video stops because it needs to buffer the next frame. |