Home >Web Front-end >H5 Tutorial >Return the attribute controller of the current media controller of audio and video in html5
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
Value | Description |
MediaController Object |
represents the audio and video media controller. MediaController object properties/methods:
|
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!