vimeo/player.js

Events play and pause not fired (timeupdate is fired) after programmatic play/pause on domain-restricted videos in Chrome

Closed this issue · 9 comments

Expected Behavior

On a domain-restricted video, in Chrome 120 (latest), fire a play event when video is played. Fire a pause event when video is paused.

Actual Behavior

The above events are not fired, although the timeupdate event is fired continuously while video is playing, and stops being fired when video is paused.

Steps to Reproduce

Run the latest Chrome - Version 120.0.6099.227 (Official Build) (64-bit) as of time of writing - and load a domain-restricted video with the player. After the video starts playing, call a pause() on the player - the video will successfully pause, the timeupdate events will stop, but there will be no pause event fired.

For a quick use-case example & repro, see this page where we use the vimeo player, in Chrome:
https://virtualracingschool.appspot.com/#/DrivingAnalyzer/297250002/1702339200000/287762809012/1705770029/2014/Start

Note that the play/pause button in the lower left correctly plays and pauses the video. If you open the console, you will see the events fired by the player:

  • note that timeupdate events are fired while video is playing
  • but play and pause events are not fired
  • at time of writing, this will cause the slider at the bottom of the linked page to keep moving even if video is paused (as we calculate current time based on the last timeupdate event plus the time elapsed with a timer that keeps running until a pause event is detected)
    image

This does NOT repro on Edge Version 121.0.2277.83 - the play and pause events appear normally there.

Update: this seems to be inconsistent - testing right now and the pause events are coming through. I've already had this happen once some time earlier, then the issue came back. I don't have an observation of what causes the events to disappear, as I've had both direct and non-direct navigation to that URL cause the issue.

I have a same problem..
play and pause event not work sometimes when I refresh page..

@itgeorge @sk31park Thanks reporting this issue - we'll take a deeper look and provide our thoughts.

At the moment I'm not seeing any missing events on your page. I also put together a JSFiddle that seems to log the expected events (this clip is domain restricted too, but I don't think that should matter).

Thanks for taking a look @rkrishnan8594 - I spent some more time to get a repro going. Again, this isn't a consistent repro, it only happens about 50% of the time for me, and the repro I managed to get requires a specific sequence of user actions.

So, please try the below snippet several times, including reloading the page, reloading the snippet, changing the video, etc.

My findings so far:

  • I got a repro with the video in &background=1 mode
  • my repro uses a 150 second seek, during which if a pause is done, the issue gets a repro
  • seems to be related to buffering/loading
  • you are right that domain restriction doesn't seem to matter

Repro steps:

  • open this snippet: https://jsfiddle.net/c59jymr7/2/
  • open the console
  • the video should auto-play, but it starts black
  • before the first words appear ("once a photograph of the Earth..."), or right as they appear, click the seek button
  • then quickly click the pause button, the video will pause but no "pause" event will be logged on the console
  • other events on the console will likely be "play", then multiple "timeupdate", then there might be a "bufferstart"/"bufferend" and potentially timeupdates, but the timeupdate will stop after the pause button is clicked

Again, this doesn't repro 100% for me - please try reloading the page, changing to another video (to potentially allow more buffering due to CDNs not having cached it), etc.

Screenshot of repro state after video paused and played multiple times with the buttons - notice only play events and timeupdate events logged, no pause events (and multiple play events wouldn't appear if the video was already playing)
image

Edit: I should probably remove "play" from my issue title, as that seems to be fired correctly based on the above. Let me know if you'd like me to do that.

I have a same problem but with setVolume👆 The event sometimes sometimes works and sometimes it doesn't

@rkrishnan8594 any update on this? Does the fiddle I provided repro the issue for you?

Hey @itgeorge - thanks again for putting together a JSFiddle and detailed reproduction steps. Unfortunately, I made about 20 attempts to reproduce the issue, but I still wasn't able to do so. Each time I saw the pause event logged to the console. Are you still reproducing this bug? Also, was this only reproducible with background mode enabled? I ask because we recently ran a test of a new background mode version that was rolled out to 50% of sessions (random assignment per session), which seems to align with your observations of when you could reproduce. We've since turned off that A/B test, which could explain why the issue appears fixed now.

Hi @rkrishnan8594 , thanks for trying this out and sorry for the late reply, I was away the last few days. And thanks for the info - yes, this was only reproducible with background mode enabled, and it appeared as an issue on code that hadn't changed for years, and yes, I don't seem to have a repro now. I agree that this aligns pretty well with the described A/B test. If you have a way to enable that new mode for that fiddle specifically (e.g. by editing the fiddle to point to a specific URL), that would be a good validation of that theory, and would probably make for a good integration test in the future - but I understand that this might be too much hassle to set up.

I'll mark this as closed for now, but if we start encountering the problem again I'll reopen this issue. Thanks again for your time!