HTML and CSS Reference
Find the complete working example in the index-vtt-4b.html file.
I.2.4. Using TextTrack events
Although the examples in the previous sections show some useful techniques and allow
event-driven style. The track element has a load event that allows you to call a function
when loading is complete in the same way you've done hundreds of times before. Because
we have limited space here, you're not going to do that right now; instead, you're going to
learn about an event that's specific to timed tracks: cuechange .
The cuechange event is fired every time a new cue is to be displayed. If you handle
the cuechange event, then instead of showing the current description whenever the user
clicks the Menu button, you can instead show the descriptions at the appropriate time. The
following listing updates the switch statement in the menu handler to attach an event to
the description track's oncuechange property when the Descriptions button is clicked.