HTML Audio/Video DOMplay()Methods

HTML Audio/Video DOM Reference Manual

Example

A video with play and pause buttons:

var myVideo=document.getElementById("video1");
function playVid()
  {
  myVideo.play();
  }
function pauseVid()
  {
  myVideo.pause();
  }

Try it Yourself »

Definition and Usage

The play() method starts playing the current audio or video.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the play() method.

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


Syntax

audio|video.play()


HTML Audio/Video DOM Reference Manualother extensions