WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM Audio Object


Audio Object

The Sound Object is new in HTML5.

The Audio object speaks to a HTML <audio> element.

Note: The <audio> component isn't upheld in Internet Explorer 8 and prior versions.

Access an Audio Object

You can get to a <audio> component by utilizing getElementById():

var x = document.getElementById("myAudio"); Try it

Create an Audio Object

You can make a <audio> component by utilizing the document.createElement() method:

var x = document.createElement("AUDIO"); Try it

Audio Object Properties

Property Description
audioTracks Returns an AudioTrackList object speaking to accessible sound tracks
autoplay Sets or returns whether the sound should begin playing when it is ready
buffered Returns a TimeRanges object speaking to the cushioned pieces of an audio
controller Returns the MediaController object speaking to the present media controller of an audio
controls Sets or returns whether a sound ought to have controls shown (play/delay etc)
crossOrigin Sets or returns the CORS settings of an audio
currentSrc Returns the URL of the current audio
currentTime Sets or returns the present playback position in a sound (in seconds)
defaultMuted Sets or returns whether the sound ought to be quieted by default
defaultPlaybackRate Sets or returns whether the default playback speed of the audio
duration Returns the length of an audio(in seconds)
ended Returns whether the playback of the sound has ended
error Returns a MediaError object speaking to the mistake condition of the audio
< loop Sets or returns whether the sound should begin playing once again once more, every time it is finished
mediaGroup Sets or returns the name of the media aggregate the audio(s) is a section of
muted Sets or returns whether the sound ought to be turned off
networkState Returns the present system condition of an audio
paused Sets or returns whether a sound is paused
playbackRate Sets or returns the speed of the sound playback
played Returns a TimeRanges object speaking to the played pieces of the audio
preload Sets or returns the estimation of the preload property of an audio
readyState Returns the present prepared condition of an audio
seekable Returns a TimeRanges object speaking to the seekable pieces of an audio
< seeking Returns whether the client is as of now looking for in the audio
src Sets or returns the estimation of the src trait of an audio
textTracks Returns a TextTrackList object speaking to the accessible content tracks
volume Sets or returns the sound volume of an audio

Audio Object Methods

Method Description
addTextTrack() Adds another content track to the audio
canPlayType() Checks whether the program can play the predetermined sound type
fastSeek() Seeks to a predetermined time in the sound player
getStartDate() Returns another Date object, speaking to the present course of events offset
load() Re-loads the sound element
play() Starts playing the audio
pause() Pauses the as of now playing audio