Class Track
The track element is used to specify timed text tracks for media elements (audio and video). It allows you to add subtitles, captions, descriptions, chapters, or metadata to media content, making it more accessible and user-friendly.
Examples:
The following convenience methods are provided for constructing instances of this bean:
See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.juneau.bean.html5.HtmlElement
accesskey, attr, attrUri, class_, contenteditable, deminimize, dir, getAttr, getAttr, getAttrs, hidden, id, lang, onabort, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, oncuechange, ondblclick, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting, self, setAttrs, spellcheck, style, tabindex, title, toString, translate
-
Constructor Details
-
Track
public Track()Creates an emptyTrackelement. -
Track
- Parameters:
src- Thesrc(Object)attribute. Can benull , in which case the attribute is stored with anull value (not removed).kind- Thekind(String)attribute. Can benull to unset the attribute.
-
-
Method Details
-
default_
default attribute.Specifies that this track should be enabled by default if no other text track is more suitable. This is useful for providing fallback captions or subtitles.
This attribute uses deminimized values:
false - Track is not enabled by default (default)true - Track is enabled by default- Other values - Passed through as-is
- Parameters:
value- Whether this track should be enabled by default. Can benull to unset the attribute.- Returns:
- This object.
-
kind
kind attribute.Specifies the type of text track. This determines how the track is used by the media element.
Possible values:
"subtitles" - Subtitles for the deaf and hard-of-hearing"captions" - Captions for the deaf and hard-of-hearing"descriptions" - Text descriptions of the video content"chapters" - Chapter titles for navigation"metadata" - Metadata for the media
- Parameters:
value- The type of text track. Can benull to unset the attribute.- Returns:
- This object.
-
label
label attribute.Specifies a user-visible label for the text track. This label is displayed in the media player's track selection menu.
The label should be descriptive and help users identify the track (e.g., "English Subtitles", "Spanish Captions").
- Parameters:
value- The user-visible label for the text track. Can benull to unset the attribute.- Returns:
- This object.
-
src
src attribute.Address of the resource.
The value can be of any of the following types:
URI,URL,String. Strings must be valid URIs.URIs defined by
UriResolvercan be used for values. -
srclang
srclang attribute.Specifies the language of the text track. This helps browsers and media players determine which track to use based on the user's language preferences.
The value should be a valid language code (e.g., "en", "es", "fr", "de").
- Parameters:
value- The language code of the text track. Can benull to unset the attribute.- Returns:
- This object.
-