VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-audio-autoplay-property/

⇱ HTML DOM Audio autoplay Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM Audio autoplay Property

Last Updated : 23 Jun, 2023

The Audio autoplay property is used for setting or returning whether audio should start playing as soon as it is loaded or not. It can be used to specify that the audio should automatically start playing as soon as it is loaded. 

Syntax: 

  • Return the autoplay property:
audioObject.autoplay
  • Set the autoplay property:
audioObject.autoplay = true|false

Property Values:

  • true|false: It is used to specify whether audio should automatically start playing as soon as it is loaded or not.

Return Values: It returns a Boolean value, that returns true if the audio automatically starts playing, otherwise it returns false

The below program illustrates the Audio autoplay Property: 

Example: Enabling autoplay for audio. 

Output:

👁 Image
 

Supported Browsers: The browser supported by HTML DOM Audio autoplay Property are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 9 and above
  • Firefox 3.5 and above
  • Opera 12.1 and above
  • Apple Safari 3.1 and above
Comment
Article Tags: