Video controller Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video

Description

The controller property returns the current media controller of the video.

Return Value

Type Description
MediaController Object Represents the media controller of the video.

MediaController Object properties/methods:

  • 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

The following code shows how to check if the video has a media controller:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="320" height="240" controls>
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>/*from w w w . ja va  2 s.com*/

<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>

Related Tutorials