HTML Audio/Video DOM Reference

 

HTML Audio and Video DOM Reference

The HTML5 DOM has methods, properties, and events for the <audio> and <video> elements.


HTML Audio/Video Methods

MethodDescription
addTextTrack()Adds a new text track to the audio/video
canPlayType()Checks if the browser can play the specified audio/video type
load()Re-loads the audio/video element
play()Starts playing the audio/video
pause()Pauses the currently playing audio/video

HTML Audio/Video Events

EventDescription
abortFires when the loading of an audio/video is aborted
canplayFires when the browser can start playing the audio/video
canplaythroughFires when the browser can play through the audio/video without stopping for buffering
durationchangeFires when the duration of the audio/video is changed
emptiedFires when the current playlist is empty
endedFires when the current playlist is ended
errorFires when an error occurred during the loading of an audio/video
loadeddataFires when the browser has loaded the current frame of the audio/video
loadedmetadataFires when the browser has loaded meta data for the audio/video
loadstartFires when the browser starts looking for the audio/video
pauseFires when the audio/video has been paused
playFires when the audio/video has been started or is no longer paused
playingFires when the audio/video is playing after having been paused or stopped for buffering
progressFires when the browser is downloading the audio/video
ratechangeFires when the playing speed of the audio/video is changed
seekedFires when the user is finished moving/skipping to a new position in the audio/video
seekingFires when the user starts moving/skipping to a new position in the audio/video
stalledFires when the browser is trying to get media data, but data is not available
suspendFires when the browser is intentionally not getting media data
timeupdateFires when the current playback position has changed
volumechangeFires when the volume has been changed
waitingFires when the video stops because it needs to buffer the next frame


HTML Audio/Video Properties

PropertyDescription
audioTracksReturns an AudioTrackList object representing available audio tracks
autoplaySets or returns whether the audio/video should start playing as soon as it is loaded
bufferedReturns a TimeRanges object representing the buffered parts of the audio/video
controllerReturns the MediaController object representing the current media controller of the audio/video
controlsSets or returns whether the audio/video should display controls (like play/pause etc.)
crossOriginSets or returns the CORS settings of the audio/video
currentSrcReturns the URL of the current audio/video
currentTimeSets or returns the current playback position in the audio/video (in seconds)
defaultMutedSets or returns whether the audio/video should be muted by default
defaultPlaybackRateSets or returns the default speed of the audio/video playback
durationReturns the length of the current audio/video (in seconds)
endedReturns whether the playback of the audio/video has ended or not
errorReturns a MediaError object representing the error state of the audio/video
loopSets or returns whether the audio/video should start over again when finished
mediaGroupSets or returns the group the audio/video belongs to (used to link multiple audio/video elements)
mutedSets or returns whether the audio/video is muted or not
networkStateReturns the current network state of the audio/video
pausedReturns whether the audio/video is paused or not
playbackRateSets or returns the speed of the audio/video playback
playedReturns a TimeRanges object representing the played parts of the audio/video
preloadSets or returns whether the audio/video should be loaded when the page loads
readyStateReturns the current ready state of the audio/video
seekableReturns a TimeRanges object representing the seekable parts of the audio/video
seekingReturns whether the user is currently seeking in the audio/video
srcSets or returns the current source of the audio/video element
startDateReturns a Date object representing the current time offset
textTracksReturns a TextTrackList object representing the available text tracks
videoTracksReturns a VideoTrackList object representing the available video tracks
volumeSets or returns the volume of the audio/video

Post a Comment

0 Comments