The selectedIndex property of the ImageTrackList interface returns the index of the selected track.
selectedIndex
index
MDN Reference