Skip to content
FrameworkStyle

media-playback-rate-button

A button that cycles through playback speed rates

Anatomy

<media-playback-rate-button></media-playback-rate-button>

Behavior

Cycles through playback rates on click. The default rate list is [0.2, 0.5, 0.7, 1, 1.2, 1.5, 1.7, 2]. After the last rate, it wraps back to the first. If the current rate isn’t in the list (e.g., set programmatically), the button jumps to the next rate greater than the current one.

When menuTrigger is enabled, activation opens the linked playback-rate menu instead of cycling through rates. Use this mode when the button is the trigger for a Menu that contains playback-rate options.

Styling

Display the current rate using the data-rate attribute:

media-playback-rate-button::after {
  content: attr(data-rate) "\00D7";
}

Accessibility

Renders a <button> with an automatic aria-label of "Playback rate {rate}" (e.g., "Playback rate 1.5"). Override with the label prop. Keyboard activation: Enter / Space.

In menu-trigger mode, the button behaves as a menu trigger and reflects menu state through the trigger attributes.

Examples

Basic Usage

<video-player class="video-player">
    <video
        src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4"
        autoplay
        muted
        playsinline
        loop
    ></video>
    <media-playback-rate-button class="media-playback-rate-button">
    </media-playback-rate-button>
</video-player>

API Reference

Props

Prop Type Default Details
disabled boolean false
label string | function ''
menuTrigger boolean false

State

State is reflected as data attributes for CSS styling.

Property Type Details
rate number
label string

Data attributes

Attribute Type Details
data-rate number