player.js icon indicating copy to clipboard operation
player.js copied to clipboard

fullscreenchange listener firing twice

Open bryananthonylewis opened this issue 2 years ago • 5 comments

I've been trying to send Google Tag Manager (GTM) stats on our Vimeo player, when it goes fullscreen. The problem is that when the fullscreenchange event gets triggered, it sends 2 GTM event pushes. I've seen a few other people posting about similar issues with events firing multiple times and haven't found a solution yet. Any help would be great.

Expected Behavior

Only run 1 time when fullscreenchange is triggered.

Actual Behavior

Runs 2 times

Steps to Reproduce

https://codepen.io/bryanlewis/pen/bGmoPpY

I also noticed it runs for each player on the same page. The codepen example shows when you go fullscreen with 1 player the fullscreenchange happens on both players.

bryananthonylewis avatar May 02 '23 21:05 bryananthonylewis

Thanks for reporting these issues @bryananthonylewis; I'm able to reproduce both of them. We'll ticket these issues internally and prioritize them for investigation soon.

rkrishnan8594 avatar May 03 '23 14:05 rkrishnan8594

Thank you for this response, I appreciate your help!

bryananthonylewis avatar May 03 '23 21:05 bryananthonylewis

Seems to happen for error events as well, any status update yet @rkrishnan8594 ?

dlueth avatar Apr 05 '24 05:04 dlueth

@dlueth can you file a separate issue for that with reproduction steps and example? Thanks.

bdougherty avatar Apr 05 '24 17:04 bdougherty

I think the issue here is this code sending a message to the player on any full screen change of the parent page https://github.com/vimeo/player.js/blob/8f371592e8a7998843505de8664c869dfe0d3f1d/src/player.js#L151-L153

I think it needs to be a little smarter about sending that message.

bdougherty avatar Apr 05 '24 18:04 bdougherty