DOM Interfaces

HTMLTrackElement

Represents an external timed text track and exposes the underlying TextTrack object and loading state. Provide a valid WebVTT resource and choose the appropriate kind; captions include relevant non-speech audio information. Example result: captions.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLTrackElement

Return Value

HTMLTrackElement

An existing HTML DOM object associated with the track element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<video>  <track id="demo" kind="captions" srclang="en" label="English"></video><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.kind);</script>
HTML Reference