Latest web development tutorials

HTML Audio / Video DOM controller properties

HTML audio / video Tag Reference HTML Audio / Video DOM Reference

Examples

Detecting whether the video media controller:

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

try it"

Definition and Usage

controller property returns audio / video current media controller.

By default, the audio / video (audio / video) elements do not have the media control. If you specify a media controller, controller properties will form MediaController object returns it.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers do not support controller attributes.


grammar

audio|video .controller

return value

类型 描述
MediaController 对象 表示音频/视频的媒体控制器。

MediaController 对象的属性/方法:

  • buffered - 获得音频/视频的缓冲范围
  • seekable - 获得音频/视频的可寻址范围
  • duration - 获得音频/视频的时长
  • currentTime - 获得或设置音频/视频的当前播放位置
  • paused - 检测音频/视频是否已暂停
  • play() - 播放音频/视频
  • pause() - 暂停音频/视频
  • played - 检测音频/视频是否已播放过
  • defaultPlaybackRate - 获得或设置音频/视频的默认播放速率
  • playbackRate - 获得或设置音频/视频的当前播放速率
  • volume - 获得或设置音频/视频的音量
  • muted - 获得或设置音频/视频是否已静音


HTML audio / video Tag Reference HTML Audio / Video DOM Reference