HTML DOM Video Object

Video object

The Video object is a new object in HTML5.

The Video object represents the HTML <video> element.

Access the Video object

You can access the <video> element by using getElementById():

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

Try it yourself

Create Video Object

You can create a <video> element by using the document.createElement() method:

var x = document.createElement("VIDEO");

Try it yourself

Video object properties

Attributes Description
audioTracks Returns an object representing the AudioTrackList of available audio tracks.
autoplay Sets or returns whether the video should play immediately after it is ready (loaded).
buffered Returns an object representing the TimeRanges of the buffered parts of the video.
controller Returns an object representing the current media controller of the video.
controls Sets or returns whether the video controls (such as play/pause) should be displayed.
crossOrigin Sets or returns the CORS settings of the video.
currentSrc Returns the current URL of the video.
currentTime Sets or returns the current playback position of the video (in seconds).
defaultMuted Sets or returns whether the video is muted by default.
defaultPlaybackRate Sets or returns the default playback rate of the video.
duration Returns the length of the video (in seconds).
ended Returns whether the playback of the video has ended.
error Returns an object representing the error state of the video.
height Sets or returns the value of the video's height attribute.
loop Sets or returns whether the video should play again at the end.
mediaGroup Sets or returns the name of the media group to which the video belongs.
muted Sets or returns whether the sound is muted.
networkState Returns the current network state of the video.
paused Sets or returns whether the video is paused.
playbackRate Sets or returns the playback speed of the video.
played Returns an object representing the TimeRanges of the played parts of the video.
poster Sets or returns the value of the video's poster attribute.
preload Sets or returns the value of the video's preload attribute.
readyState Returns the current ready state of the video.
seekable Returns an object representing the TimeRanges of the addressable parts of the video.
seeking Return whether the user is currently seeking in the video.
src Set or return the value of the video's src attribute.
startDate Return the Date object representing the current time offset.
textTracks Return the TextTrackList object representing the available text tracks.
videoTracks Return the VideoTrackList object representing the available video tracks.
volume Set or return the volume of the video.
width Set or return the value of the video's width attribute.

Video object methods

Method Description
addTextTrack() Add a new text track to the video.
canPlayType() Check if the browser can play the specified video type.
load() Reload the video element.
play() Start playing the video.
pause() Pause the current playing video.

Standard properties and events

Video object supports standardsAttributesAndEvents.

Related pages

HTML tutorial:HTML5 video

HTML reference manual:HTML <video> tag