MDN self-hosted library · e01.org
VideoTrack / notebook

VideoTrack

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const el = document.querySelector("video");
const tracks = el.videoTracks;
js
const firstTrack = tracks[0];
js
for (const track of tracks) {
  if (track.language === userLanguage) {
    track.selected = true;
    break;
  }
}