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;

Try it yourself

Example 2

Set the audio to play faster by default:

document.getElementById("myAudio").defaultPlaybackRate = 2;

Try it yourself

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:

  • 1.0 is the normal speed
  • 0.5 is half speed (slower)
  • 2.0 is double speed (faster)
  • -1.0 is backward, normal speed
  • -0.5 is backward, half speed

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