YouTip LogoYouTip

Prop Audio Volume

HTML DOM Audio volume Property

HTML DOM Audio volume Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

JavaScript Array Object JavaScript Boolean Object JavaScript Date Object JavaScript Math Object JavaScript Number Object JavaScript String Object JavaScript RegExp Object JavaScript Global Properties/Functions JavaScript Operators JavaScript Error

Browser Objects

Window Object Navigator Object Screen Object History Object Location Object Storage Object

DOM Objects

HTML DOM Document Object HTML DOM Element Object HTML DOM Attribute Object HTML DOM Event Object HTML DOM Console Object CSSStyleDeclaration Object DOM HTMLCollection

HTML Objects

<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset > <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>

HTML DOM Area Object

HTML DOM Base Object

Audio volume Property

Image 8: Audio Object Reference Audio Object

Example

Set the audio volume to 20%:

document.getElementById("myAudio").volume = 0.2;

Try it Yourself Β»


Definition and Usage

The volume property sets or returns the volume of the audio, from 0.0 (muted) to 1.0 (loudest).

Note: The <audio> element is new in HTML5.


Browser Support

Image 9: Internet ExplorerImage 10: FirefoxImage 11: OperaImage 12: Google ChromeImage 13: Safari

The volume property is supported by all major browsers.

Note: Internet Explorer 8 or earlier browsers do not support this property.


Syntax

Return the volume property:

audioObject.volume

Set the volume property:

audioObject.volume=number

Property Values

Value Description
volumevalue Specifies the current volume of the audio. Must be a number between 0.0 and 1.0.
Example values:
* 1.0 is highest volume (default)
* 0.5 is half volume (50%)
* 0.0 is muted

Technical Details

Return Value: A number value representing the volume of the audio.
Default Value: 1.0

Image 14: Audio Object Reference Audio Object

HTML DOM Area Object

HTML DOM Base Object

iFlytek Coding Plan includes free model call quota, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform. Configuration Guide Β₯3.9/month Subscribe Now

Click to Share Notes

Cancel

Write notes...

Image URL

Image Description

← Met Audio AddtexttrackProp Audio Texttracks β†’