Find out if the video has a media controller:
var x = document.getElementById("myVideo").controller;
Click the button to check if the video has a media controller.
The controller property is not supported in any major browsers.
<!DOCTYPE html> <html> <body> <video id="myVideo" width="100" height="100" controls> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support the video tag. </video>/* ww w . j a v a 2s .c om*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo").controller; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The controller property returns the current media controller of the video.
By default the <video> element does not have a media controller.
If a media controller is set, the controller property returns a MediaController object.
MediaController Object represents the media controller of the video.
MediaController Object properties/methods:
Property | Description |
---|---|
buffered | get the buffered ranges of the video |
seekable | get the seekable ranges of the video |
duration | get the duration of the video |
currentTime | get or set the current playback position of the video |
paused | check if the video is paused |
play() | play the video |
pause() | pause the video |
played | check if the video has been played |
defaultPlaybackRate | get or set the default playback rate of the video |
playbackRate | get or set the current playback rate of the video |
volume | get or set the volume of the video |
muted | get or set if the video is muted |