I'm having an issue with the video element events:
I only want to fire off an analytics event when the play or pause button is interacted with. The play, pause, and playing events work as expected up until the seek functionality is used.
I'd like to isolate the play/pause events from the ones fired through seek/seeking.
When the video is playing and it is clicked (moved to a different point), the play, playing, and pause events are triggered because the video will pause to buffer and start playing the video again. This order is not always the same. When paused you don't get any of these events.
When debugging the playing and pause events, I've seen the following order:
Pause, Seeking, Seeked, PlayingPause, Playing, Seeking, Seeked, PlayingThis link to w3.org/mediaevents gives you a good indication of the above.
I've set up my own version in jsfiddle (see console logs).
I've tried setting a flag that is reset on a timeout and setting/checking the last state for each event e.g. lastEvent = 'seeking'. None of these worked 100% because of the inconsistent fire order. If you drag the seek bar it won't fire the play, playing, or paused events which adds another scenario.