Thuộc tính bộ điều khiển DOM Audio / Video HTML

❮ Tham chiếu DOM Audio / Video HTML

Thí dụ

Kiểm tra xem video có bộ điều khiển phương tiện hay không:

var vid = document.getElementById("myVideo");
alert("Controller: " + vid.controller);

Định nghĩa và Cách sử dụng

Thuộc tính bộ điều khiển trả về bộ điều khiển phương tiện hiện tại của âm thanh / video.

Theo mặc định, phần tử âm thanh / video không có bộ điều khiển phương tiện. Nếu một bộ điều khiển phương tiện được chỉ định, thuộc tính bộ điều khiển sẽ trả về nó dưới dạng một đối tượng MediaController.

Mẹo: Sử dụng thuộc tính điều khiển để đặt hoặc trả lại liệu video có hiển thị các điều khiển video tiêu chuẩn hay không.


Hỗ trợ trình duyệt

Property
controller Not supported Not supported Not supported Not supported Not supported

Cú pháp

audio|video.controller

Giá trị trả lại

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

MediaController Object properties/methods:

  • buffered - get the buffered ranges of the audio/video
  • seekable - get the seekable ranges of the audio/video
  • duration - get the duration of the audio/video
  • currentTime - get or set the current playback position of the audio/video
  • paused - check if the audio/video is paused
  • play() - play the audio/video
  • pause() - pause the audio/video
  • played - check if the audio/video has been played
  • defaultPlaybackRate - get or set the default playback rate of the audio/video
  • playbackRate - get or set the current playback rate of the audio/video
  • volume - get or set the volume of the audio/video
  • muted - get or set if the audio/video is muted

❮ Tham chiếu DOM Audio / Video HTML