Definition
The default
attribute, when used with the <track>
element, specifies that the text track should be enabled.
Applicable Elements
The default
attribute can be used with the following elements:
HTML <track>
default
Attribute
A <track>
element is used as a child of the <audio>
or <video>
elements to define a text track, such as captions, subtitles, or descriptions.
The default
attribute, when used with the <track>
element, specifies that the text track should be enabled.
Syntax
<track default kind="captions" src="/rise-of-theskywalker.vtt" />
Usage
- The
default
attribute is a boolean. If present, the audio player should use the track unless the user’s preferences indicate another track is more appropriate. - It can only be used on one
<track>
element for each<audio>
or<video>
elements.
Values
Values can include:
default
Examples
The following example shows a video that automatically displays captions when played:
<video controls
src="/rise-of-theskywalker.mp4">
<track default
kind="captions"
srclang="en"
src="/rise-of-theskywalker.vtt" />
Sorry, your browser doesn't support embedded videos.
</video>
Specification
The default
HTML specification for the <track>
element is as follows:
Browser Support
The default
attribute has the following browser support:
Desktop
Chrome | Edge | Firefox | IE | Opera | Safari | |
---|---|---|---|---|---|---|
<default> | Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet | |
---|---|---|---|---|---|---|
<default> | Yes | Yes | Yes | Unknown | Unknown | Yes |