Latest web development tutorials

HTML DOM Audio controls property

Audio Object Reference Audio Object

Examples

Start audio controls ::

document.getElementById("myAudio").controls = true;

try it"

Definition and Usage

controls property sets or returns the browser should display the standard audio and video controls.

This property reflects the <audio> Control Properties.

If the attribute is present, it specifies the display of audio controls.

Audio and video controls include:

  • Broadcast
  • time out
  • progress bar
  • volume

Note: <audio> elements in HTML5 is newly added.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support controls property.

Note: Internet Explorer 8 or earlier browser does not support the <audio> Properties.


grammar

Returns controls properties:

audioObject .controls

Setting controls properties:

audioObject .controls=true|false

Property Value

描述
true|false 指定音频是否显示控件。
  • true - 指定显示控件。
  • false - 默认。指定不显示控件。

technical details

return value: Boolean value that, if the audio setting display control returns true, otherwise it returns false.
Defaults: false


More examples

Examples

Check whether the audio controls appear:

var x = document.getElementById("myAudio").controls;
x The output is:
true

try it"


related articles

HTML Reference Manual: HTML <Audio> Controls property


Audio Object Reference Audio Object