Latest web development tutorials

HTML DOM Video play () method

Video Object Reference Video Object

Examples

A video with a play and pause button:

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

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

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

try it"

Definition and Usage

play () method to start playing the current audio or video.

Note: This method is usually the pause () used with the method.

Tip: Use the controls property to display the video controls (such as: play, pause, search, volume, etc.).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the play () method

Note: Internet Explorer 8 and earlier versions of IE does not support this method.


grammar

videoObject .play()

parameter

None

return value

No return value


Video Object Reference Video Object