Home > Article > Web Front-end > JavaScript Strengthening Tutorial——Audio/Video
This article is the official HTML5 training tutorial of H5EDU organization. It mainly introduces: JavaScript enhancement tutorial - Audio/Video
HTML5 Audio/Video method
Method description
addTextTrack() Add a new text track to audio/video
canPlayType() detect browsing 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 Attribute
Attribute Description
audioTracks Returns the AudioTrackList object representing the available audio tracks
autoplay Sets or returns whether to play the audio/video immediately after loading is completed
buffered Returns the TimeRanges object representing the buffered part of the audio/video
controller Returns the MediaController representing the current media controller of the audio/video Object
controls sets or returns whether audio/video displays controls (such as play/pause, etc.)
crossOrigin sets or returns the CORS setting of audio/video
currentSrc returns the URL of the current audio/video
currentTime sets or returns the current value in audio/video Playback position (in seconds)
defaultMuted Sets or returns whether audio/video is muted by default
defaultPlaybackRate Sets or returns the default playback speed of audio/video
duration Returns the length of the current audio/video (in seconds)
ended Returns audio/video Whether the playback has ended
error Returns a MediaError object representing the audio/video error status
loop Sets or returns whether the audio/video should be replayed at the end
mediaGroup Sets or returns the group to which the audio/video belongs (used to connect multiple audios /Video element)
muted Sets or returns whether the audio/video is muted
networkState Returns the current network status of the audio/video
paused Sets or returns whether the audio/video is paused
playbackRate Sets or returns the speed of audio/video playback
played Returns the audio / TimeRanges object of the played part of the video
preload Sets or returns whether the audio/video should be loaded after the page is loaded
readyState Returns the current readiness state of the audio/video
seekable Returns a TimeRanges object representing the addressable part of the audio/video
seeking Returns whether the user is searching in audio/video
src Sets or returns the current source of audio/video elements
startDate Returns a Date object representing the current time offset
textTracks Returns a TextTrackList object representing available text tracks
videoTracks Returns representing available video tracks VideoTrackList object
volume Sets or returns the volume of the audio/video
HTML5 Audio/Video event
Event Description
abort When the loading of the audio/video has been abandoned
canplay When the browser can play the audio/video
canplaythrough When the browser can When playing without pausing due to buffering
durationchange When the duration of the audio/video has changed
emptied When the current playlist is empty
ended When the current playlist has ended
error When in the audio/video When an error occurs during loading
loadeddata When the browser has loaded the current frame of the audio/video
loadedmetadata When the browser has loaded the metadata of the audio/video
loadstart When the browser starts looking for the audio/video
pause When the audio/video When paused
play When the audio/video has started or is no longer paused
playing When the audio/video is ready after having been paused or stopped due to buffering
progress When the browser is downloading the audio/video
ratechange When the audio/ When the playback speed of the video has changed
seeked When the user has moved/jumped to a new position in the audio/video
seeking When the user has started moving/jumping to a new position in the audio/video
stalled When the browser tries to get the media data , but the data is not available
suspend When the browser deliberately does not obtain the media data
timeupdate When the current playback position has changed
volumechange When the volume has changed
waiting When the video stops due to the need to buffer the next frame