Audio play() method
Definition and Usage
play()
method to start playing the current audio.
Tip:This method is usually used with pause() method together.
Tip:Please use controls attribute Display audio controls (such as play, pause, search, volume, etc.).
Example
Audio player with play and pause buttons:
var x = document.getElementById("myAudio"); function playAudio() { x.play(); } function pauseAudio() { x.pause(); }
Syntax
audioObject.play()
Parameters
None.
Return Value
No Return Value.
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 9.0 | Support | Support | Support |