Easy Tutorial
❮ Prop Loc Protocol Prop Error Message ❯

Audio play() Method

Audio Object

Example

A piece of audio with play and pause buttons:

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

function playAudio()
{ 
     x.play(); 
} 

function pauseAudio()
{ 
    x.pause(); 
}

Definition and Usage

The play() method starts playing the current audio.

Tip: This method is often used together with the pause() method.

Tip: Use the controls attribute to display audio controls (such as play, pause, seeking, volume, etc.) on the audio.


Browser Support

All major browsers support the play() method.

Note: Internet Explorer 8 or earlier versions do not support this method.


Syntax

Parameters

| None |

Return Value

| No return value |


❮ Prop Loc Protocol Prop Error Message ❯