mickey / videojs-ga

Google Analytics plugin for video.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

play/pause not always tracking due "seeking"

mfn opened this issue · comments

I'm not sure what's here exactly at fault, but the play/pause events in my case are not tracked because "seeking" is "true" all the time.

The workflow I see is the following:

  1. user initiates playing the video, play gets triggered for the first time
  2. in this case, currentTime === 0 which means the play beacon gets not sent; but that's ok (I guess), the start event was triggered before anyway. But nevertheless, seeking gets set to true
  3. if the user now hits pause, the check looks like this: if currentTime != duration && !seeking. Since now seeking has been set to true and I don't see code setting it to false, play/pause will never trigger sendbeacon

I removed the seeking = true in play and in my limited testing it worked.

After some more testing I think that in play it was meant to reset seeking to false. Some testing showed good result.

However, there's one case which is still a problem after this change:

  1. play
  2. pause
  3. seek
  4. play
  5. The last play event is not triggered

Successive pause/play events however are triggered.

Hey @mfn,
You were right about the seeking = true bug.
I fixed it in a previous commit.
I also fixed the issue with the play event not being sent after a seek.