I am trying to determine if a TextTrack html video element is currently being displayed.
I took a look at the html specifications and at first glance, the texttracks.mode property will work perfectly according to: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html # text-track-hidden
I tested this property with the following html and code in google chrome version 35.0.1916.153:
HTML:
<video> <track id="en" kind="subtitles" src="transcript.vtt"></track> <source src = "samplevideo.mp4"> </video>
code:
$(video)[0].textTracks[0].mode
Initially, the code returns “hidden”, as expected, and after pressing the transcription button on the video player and restarting the code, it returns “show”.
If I disconnect the player after these steps and repeat the code, it still returns a “show”, despite the hiding of transcripts on the video.
Is there a better way to detect the visible / invisible state of transcripts on an html5 video player?
source share