YouTip LogoYouTip

Prop Video Controls

HTML DOM Video controls Property

HTML DOM Video controls Property

-- Learning not just skills, but dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM Track Object

HTML DOM Video currentSrc Property

Video controls Property

Video Object Reference Video Object

Example

Enable video controls:

document.getElementById("myVideo").controls=true;

Try it yourself Β»


Definition and Usage

The controls property sets or returns whether the browser should display standard video controls.

This property reflects the <video> controls attribute.

When used, this property specifies that video controls should be displayed.

Video controls include:

  • Play
  • Pause
  • Progress bar
  • Volume
  • Fullscreen toggle (for video)
  • Captions (when available)
  • Tracks (when available)

Note: The <video> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The controls property is supported in all major browsers.

Note: Internet Explorer 8 and earlier IE versions do not support the <video> element.


Syntax

Return the controls property:

videoObject.controls

Set the controls property:

videoObject.controls=true|false

Property Values

Value Description
true|false Specifies whether video controls should be displayed:
* true - Specifies that controls should be displayed
* false - Default. Specifies that controls should not be displayed

Technical Details

Return Value: A Boolean. Returns true if video controls are displayed, otherwise false.
Default Value: false

More Examples

Example

Check if video controls are displayed:

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

The x output will be:

true

Try it yourself Β»

Example

Enable, disable, and check controls status:

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

function enableControls(){
    x.controls = true;
    x.load();
}

function disableControls(){
    x.controls = false;
    x.load();
}

function checkControls(){
    alert(x.controls);
}

Try it yourself Β»


Related Pages

HTML Reference: HTML <video> controls Attribute


Video Object Reference Video Object

← Prop Video CurrentsrcProp Video Controls β†’