Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Audio defaultPlaybackRate attribute

Audio defaultPlaybackRate attribute

Audio Object Reference Audio object

Example

Set the audio to play at a low speed by default:

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

Try it »


Definition and Usage

The defaultPlaybackRate attribute sets or returns the default playback speed of the audio.

Setting this attribute only changes the default playback speed, not the current one. To change the current playback speed, use playbackRate attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the defaultPlaybackRate attribute, except Safari.

Note: Internet Explorer 8 and earlier IE versions do not support the defaultPlaybackRate attribute.


Syntax

Return the defaultPlaybackRate attribute:

audioObject

.defaultPlaybackRate

Set the defaultPlaybackRate attribute:

audioObject

.defaultPlaybackRate=

number

Attribute values

Value Description
playbackspeed

Indicates the default playback speed of the audio/video.

Example values:

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

    Technical Details

    Return Value: Numeric value, the default playback speed
    Default value: 1.0

    More examples

    Example

    Set the audio to play fast by default:

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

    Try it »


    Audio Object Reference Audio object