Properti pengontrol DOM Audio/Video HTML

Referensi DOM Audio/Video HTML

Contoh

Periksa apakah video memiliki pengontrol media:

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

Definisi dan Penggunaan

Properti controller mengembalikan pengontrol media audio/video saat ini.

Secara default, elemen audio/video tidak memiliki pengontrol media. Jika pengontrol media ditentukan, properti pengontrol akan mengembalikannya sebagai objek MediaController.

Kiat: Gunakan properti kontrol untuk menyetel atau mengembalikan apakah video harus menampilkan kontrol video standar.


Dukungan Peramban

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

Sintaksis

audio|video.controller

Nilai Kembali

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

Referensi DOM Audio/Video HTML