vimeo / player.js

Interact with and control an embedded Vimeo Player.
https://player.vimeo.com/api/demo
MIT License
1.43k stars 261 forks source link

fullscreenchange listener firing twice #926

Open bryananthonylewis opened 1 year ago

bryananthonylewis commented 1 year ago

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.

rkrishnan8594 commented 1 year ago

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.

bryananthonylewis commented 1 year ago

Thank you for this response, I appreciate your help!

dlueth commented 5 months ago

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

bdougherty commented 5 months ago

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

bdougherty commented 5 months ago

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.