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

Fixing video playback on Firefox. Using requestAnimationFrame as a fallback for when requestVideoFrameCallback is undefined #416

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

queenOfPentacls
Copy link

Playing videos in HTML5 on Firefox has really bad laggy playback performance. This is a workaround using requestAnimationFrame which is compatible with Firefox/other browsers that don't support requestVideoFrameCallback. This was project-ruining on the game I'm working on, so I hope sharing this here will help some other people out who were running into this issue.

One thing about this is I'm hardcoding the FPS to 30. I'm not sure if its possible to derive that directly from the video source or if the FPS should be defined inside the video object inside of Gamemaker.

I'm also wrapping the updateVideoFrame function in a conditional checking the state of g_VideoUserEnded, was encountering memory leak issues otherwise but it doesn't feel right to me.

@queenOfPentacls queenOfPentacls changed the title Using requestAnimationFrame as a fallback for when requestVideoFrameCallback is undefined Fixing video playback on Firefox. Using requestAnimationFrame as a fallback for when requestVideoFrameCallback is undefined Dec 22, 2023
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

Successfully merging this pull request may close these issues.

1 participant