TextTrack: id property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2018.

The id read-only property of the TextTrack interface returns the ID of the track if it has one.

Value

A string containing the ID, or an empty string.

Examples

In the following example the value of id is printed to the console.

js
const video = document.querySelector("video");
const track = video.addTextTrack("captions", "Captions", "en");
track.mode = "showing";
console.log(track.id);

Specifications

Specification
HTML
# dom-texttrack-id-dev

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
id
Chrome – Full support
Chrome 33 (Release date: 2014-02-20)
footnote Full support
Edge – Full support
Edge 18 (Release date: 2018-10-02)
footnote Full support
Firefox – Full support
Firefox 31 (Release date: 2014-07-22)
footnote Full support
Opera – Full support
Opera 20 (Release date: 2014-03-04)
footnote Full support
Safari – Full support
Safari 8 (Release date: 2014-10-16)
footnote Full support
Chrome Android – Full support
Chrome Android 33 (Release date: 2014-02-26)
footnote Full support
Firefox for Android – Full support
Firefox for Android 31 (Release date: 2014-07-22)
footnote Full support
Opera Android – Full support
Opera Android 20 (Release date: 2014-03-06)
footnote Full support
Safari on iOS – Full support
Safari on iOS 8 (Release date: 2014-09-17)
footnote Full support
Samsung Internet – Full support
Samsung Internet 2 (Release date: 2014-10-17)
footnote Full support
WebView Android – Full support
WebView Android 4.4.3 (Release date: 2014-06-02)
footnote Full support
WebView on iOS – Full support
WebView on iOS 8 (Release date: 2014-09-17)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support