How does the Touch-Bar interact with HTML5 videos, and other media on the web?
The touch bar controller does not interact as such directly with HTML5 and it is not using Javascript.

It is instead the other way around. It is the browser that asks the touch bar controller to do something (i.e. for example to display buttons for previous and next page, open tab, etc.). This is done through the NSTouchBar class provided by Apple in AppKit.

The touch bar hardware in itself does not for example know that a button means to open a new tab in Firefox. Instead the application (for example Firefox) is told via NSTouchBar that the button has been pressed, and the application (Firefox in this example) must implement that functionality itself.

Therefore it is the browser that implements the action and thus controls the video – not the TouchBar.