Video controls Property
Example
Enable controls for a video:
document.getElementById("myVideo").controls = true;
Try it Yourself »
Description
The controls property sets or returns whether a video should display standard video controls.
This property reflects the <video> controls attribute.
When present, it specifies that the video controls should be displayed.
Video controls should include:
- Play
- Pause
- Seeking
- Volume
- Fullscreen toggle
- Captions/Subtitles (when available)
- Track (when available)
Browser Support
Property | |||||
---|---|---|---|---|---|
controls | Yes | 9.0 | Yes | Yes | Yes |
Syntax
Return the controls property:
videoObject.controls
Set the controls property:
videoObject.controls = true|false
Property Values
Value | Description |
---|---|
true|false | Specifies whether a video should have controls displayed, or not
|
Technical Details
Return Value: | A Boolean, returns true if video controls are displayed, otherwise it returns false |
---|---|
Default Value: | false |
More Examples
Example
Find out if the video controls are displayed:
var x = document.getElementById("myVideo").controls;
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