How do you detect when a HTML5 element has finished playing?
Here is a simple approach which triggers when the video ends.
etc ...
In the 'EventListener' line substitute the word 'ended' with 'pause' or 'play' to capture those events as well.