Skip to content
FrameworkStyle

media-playback-rate-radio-group

A menu radio group for selecting playback speed

Creates radio items from the player playback rate state and selects the playback speed.

Import

import '@videojs/html/ui/playback-rate-radio-group';

Anatomy

<media-playback-rate-radio-group>
  <template>
    <media-menu-radio-item>
      <span data-part="label"></span>
      <media-menu-item-indicator></media-menu-item-indicator>
    </media-menu-radio-item>
  </template>
</media-playback-rate-radio-group>

Behavior

The group is available when the configured media exposes playback rates. Option labels default to the rate followed by a multiplication sign (e.g. 1.5×); pass formatRate to customize them.

<media-playback-rate-radio-group> generates <media-menu-radio-item> children. Add an optional <template> with a single <media-menu-radio-item> to customize each generated item.

Styling

Attribute Values Description
data-rate number Current playback rate.
data-disabled Present / absent Present when playback rate selection is disabled.
data-hidden Present / absent Present when playback-rate selection is unavailable.
data-availability "available" / "unavailable" Whether playback rates are available.

Unavailable groups receive the native hidden attribute.

Accessibility

The group uses the menu radio group pattern.

The element receives an accessible label from the label property or defaults to Playback rate. Override it with aria-label or aria-labelledby.

Examples

Basic usage

<video-player class="video-player">
  <media-container>
    <video src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM/highest.mp4" autoplay muted playsinline loop></video>
    <div class="menu-bar">
      <button type="button" commandfor="speed-menu" class="settings-trigger">Speed</button>
      <media-menu id="speed-menu" side="top" align="end" class="menu">
        <media-menu-content>
          <media-playback-rate-radio-group class="menu-group" aria-label="Speed">
            <template>
              <media-menu-radio-item class="menu-item">
                <span data-part="label"></span>
                <media-menu-item-indicator force-mount class="menu-indicator"></media-menu-item-indicator>
              </media-menu-radio-item>
            </template>
          </media-playback-rate-radio-group>
        </media-menu-content>
      </media-menu>
    </div>
  </media-container>
</video-player>

API Reference

media-playback-rate-radio-group

Displays the selected playback-rate label.

Events

EventDescription
value-changeFired when the selected value changes.