Home >Web Front-end >H5 Tutorial >Return the attribute controller of the current media controller of audio and video in html5

Return the attribute controller of the current media controller of audio and video in html5

黄舟
黄舟Original
2017-11-08 09:40:312106browse

Example

Detect whether the video has mediaController:

myVid=document.getElementById("video1");
alert("Controller: " + myVid.controller);

Definition and usage

controller AttributeReturns the current media controller of audio and video.

By default, audio and video elements will not have media controllers. If a media controller is specified, the controller property returns it as a MediaController.

Browser support

The controller attribute is not supported by any mainstream browser.

Syntax

audio|video.controller
##Example
Value Description
MediaController Object

represents the audio and video media controller.

MediaController object properties/methods:

  • buffered - Get the buffering range of audio and video

  • seekable - or audio and video Addressable range

  • duration - Gets the duration of audio and video

  • currentTime - Gets or sets the duration of audio and video Current play position

  • paused - Check whether the audio and video has been paused

  • play() - Play the audio and video

  • pause() - Pause the audio and video

  • played - Check whether the audio and video has been played

  • defaultPlaybackRate - Get or set the audio The default playback rate of video

  • playbackRate - Get or set the current playback rate of audio and video

  • ##volume - Get or set the volume of audio and video

  • muted - Gets or sets whether the audio and video are muted

Detect whether the video has a media controller:

<!DOCTYPE html> 
<html> 
<body> 

<p>
	<button onclick="checkMedCont()" type="button">检查视频是否拥有媒体控制器</button>
</p>

<video id="video1" controls="controls">
	<source src="/kf51/demo/mov_bbb.mp4" type="video/mp4">
	<source src="/kf51/demo/mov_bbb.ogg" type="video/ogg">
	您的浏览器不支持 video 标签。
</video>

<script>
var myVid = document.getElementById("video1");
function checkMedCont() { 
	alert("Controller: " + myVid.controller);
} 
</script> 

</body> 
</html>

The above is the detailed content of Return the attribute controller of the current media controller of audio and video in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn