Video controls attribute
Definition and usage
controls
Attribute setting or returning whether the standard video controls should be displayed.
This attribute indicates <video> controls attribute.
If this attribute is set, it specifies that the video controls should be displayed.
The video controls should include:
- Play
- Pause
- Search
- Volume
- Toggle full screen
- Subtitles (when available)
- Track (when available)
Example
Example 1
Enable video controls:
document.getElementById("myVideo").controls = true;
Example 2
Check if the video controls are displayed:
var x = document.getElementById("myVideo").controls;
Example 3
Enable, disable, and check the control 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); }
Syntax
Return the controls attribute:
videoObject.controls
Set the controls attribute:
videoObject.controls = true|false
attribute value
value | description |
---|---|
true|false |
Specifies whether the video should display controls.
|
Technical Details
Return Value: | Boolean value, returns true if the video control is displayed; otherwise returns false. |
---|---|
Default Value: | false |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 9.0 | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <video> controls Attribute