YouTip LogoYouTip

Dom Obj Video

HTML DOM Video Object

HTML DOM Video Object

Video Object

The Video object was introduced in HTML5.

The Video object represents an HTML <video> element.

Accessing the Video Object

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

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

Try it

Creating a Video Object

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

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

Try it

Video Object Properties

Property Description
audioTracks Returns an AudioTrackList object representing the available audio tracks.
autoplay Sets or returns whether the video should start playing as soon as it is ready.
buffered Returns a TimeRanges object representing the buffered parts of the video.
controller Returns a MediaController object representing the current media controller of the video.
controls Sets or returns whether the video should display controls (like play/pause etc.).
crossOrigin Sets or returns the CORS settings of the video.
currentSrc Returns the URL of the current video.
currentTime Sets or returns the current playback position in the video (in seconds).
defaultMuted Sets or returns whether the video is muted by default.
defaultPlaybackRate Sets or returns the default playback speed of the video.
duration Returns the length of the video (in seconds).
ended Returns whether the video playback has ended.
error Returns a MediaError object representing the error state of the video.
height Sets or returns the value of the height attribute of the video.
loop Sets or returns whether the video should start over again when finished.
mediaGroup Sets or returns the name of the media group the video belongs to.
muted Sets or returns whether the sound is turned off.
networkState Returns the network state of the video.
← Prop Track SrcProp Track Readystate β†’