Skip to content
FrameworkStyle

media-audio-track-radio-group

A menu radio group for selecting an audio track

Creates radio items from the player audio track state and selects the enabled track.

Import

import '@videojs/html/ui/audio-track-radio-group';

Anatomy

<media-audio-track-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-audio-track-radio-group>

Behavior

The group is available when the configured media exposes more than one audio track. Labels use the track label, then language, then kind. Pass formatTrack to customize the visible labels.

<media-audio-track-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-audio-track string Current audio track value.
data-disabled Present / absent Present when audio track selection is disabled.
data-hidden Present / absent Present when multiple audio tracks are unavailable.
data-availability "available" / "unavailable" Whether multiple audio tracks 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 Audio.

Examples

Basic usage

<video-player class="video-player">
  <media-container>
    <hlsjs-video
      class="video-media"
      src="https://stream.mux.com/s41JYeqIpBMBzE4OzxDyGR2yrp2hD1CQ6gJN9SlVGDQ.m3u8"
      autoplay
      crossorigin="anonymous"
      muted
      playsinline
      loop
    ></hlsjs-video>
    <div class="menu-bar">
      <button type="button" commandfor="audio-menu" class="settings-trigger">Audio</button>
      <media-menu id="audio-menu" side="top" align="end" class="menu">
        <media-menu-content>
          <media-audio-track-radio-group class="menu-group" label="Audio tracks">
            <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-audio-track-radio-group>
        </media-menu-content>
      </media-menu>
    </div>
  </media-container>
</video-player>

API Reference

media-audio-track-radio-group

Displays the selected audio-track label.

Events

EventDescription
value-changeFired when the selected value changes.