**Common Examples:**
β’ `1.0`: Normal speed (Default)
β’ `0.5`: Half speed (Slower)
β’ `2.0`: Double speed (Faster)
β’ `-1.0`: Normal speed in reverse (Not widely supported)
β’ `-0.5`: Half speed in reverse (Not widely supported) | --- ## Technical Details | Feature | Description | | :--- | :--- | | **Return Value** | A `Number` representing the current playback speed. | | **Default Value** | `1.0` | | **DOM Level** | HTML5 Media Element | --- ## Code Examples ### Example 1: Setting a Video to Slow Motion (0.5x) This example demonstrates how to select a video element and slow its playback speed down to half-speed. ```html ``` ### Example 2: Creating a Custom Speed Controller This example shows how to build a simple interactive speed controller using HTML buttons. ```html
Current Speed: 1.0x
``` --- ## Important Considerations 1. **Audio Pitch Correction:** Modern browsers automatically apply pitch correction (preserving the natural pitch of voices) when the `playbackRate` is altered. If you want to disable this and allow the pitch to change with speed, you can set the `preservesPitch` property to `false` (where supported): ```javascript video.preservesPitch = false; // Pitch will change with speed ``` 2. **Negative Values (Reverse Playback):** While the HTML5 specification mentions that negative values (like `-1.0`) should play the media backward, most major browsers do not fully support reverse playback or may mute the audio when doing so. 3. **Browser Limits:** Browsers impose upper and lower limits on playback speed (for example, Google Chrome limits playback speed between `0.0625` and `16.0`). Values outside the browser's supported range will be ignored or clamped. 4. **Browser Compatibility:** This property is supported in all modern browsers. It is not supported in Internet Explorer 9 and earlier versions.
YouTip