Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The addTextTrack() method of the HTMLMediaElement interface creates a new TextTrack object and adds it to the media element. It fires an addtrack event on this media element's textTracks. This method can't be used on a TextTrackList interface, only an HTMLMediaElement.
A string representing the TextTrack.kind property (subtitles, captions, descriptions, chapters, or metadata).
labelA string representing the TextTrack.label property.
languageA string representing the TextTrack.language property.
The newly created TextTrack object.
None.
This example adds a new TextTrack with the kind set to "subtitles", and adds a new VTTCue to that.
| HTML # dom-media-addtexttrack-dev |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Dec 19, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.