Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fullscreenchange listener firing twice #926

Open
bryananthonylewis opened this issue May 2, 2023 · 5 comments
Open

fullscreenchange listener firing twice #926

bryananthonylewis opened this issue May 2, 2023 · 5 comments

Comments

@bryananthonylewis
Copy link

bryananthonylewis commented May 2, 2023

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
Copy link
Contributor

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
Copy link
Author

Thank you for this response, I appreciate your help!

@dlueth
Copy link

dlueth commented Apr 5, 2024

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

@bdougherty bdougherty changed the title Player event listener firing twice fullscreenchange listener firing twice Apr 5, 2024
@bdougherty
Copy link
Member

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

@bdougherty
Copy link
Member

I think the issue here is this code sending a message to the player on any full screen change of the parent page

player.js/src/player.js

Lines 151 to 153 in 8f37159

this.ready().then(() => {
postMessage(this, 'fullscreenchange', screenfull.isFullscreen);
});

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants