Audio defaultPlaybackRate attribute
Definition and usage
defaultPlaybackRate
This attribute sets or returns the default playback speed of the audio.
Tip:Setting this attribute will only change the default playback speed, not the current playback speed. To change the current playback speed, please use playbackRate attribute.
Instance
Example 1
Set the audio to play slower by default:
document.getElementById("myAudio").defaultPlaybackRate = 0.5;
Example 2
Set the audio to play faster by default:
document.getElementById("myAudio").defaultPlaybackRate = 2;
Syntax
Return the defaultPlaybackRate attribute:
audioObject.defaultPlaybackRate
Set the defaultPlaybackRate attribute:
audioObject.defaultPlaybackRate = number
Attribute value
Value | Description |
---|---|
number |
Indicates the default playback speed of the audio. Example values:
Note:Value 0.0 is invalid and raises a NOT_SUPPORTED_ERR exception. |
Technical Details
Return Value: | A number representing the default playback speed. |
---|---|
Default Value: | 1.0 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | Supported | Supported | Not Supported | Supported |