-
Notifications
You must be signed in to change notification settings - Fork 132
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
[bug] Cannot render more than a few video streams on web with overlayed participant names. #358
Comments
how to use createImageBitmap? do we need to create one timer.interval to refresh the videos; |
createImageBitmap allows you to render a texture in flutter based off of a DOM media element (for example an img or video element can be used as a source). Under the covers, it ties into the browser APIs that exist to allow videos and images to be loaded and rendered into WebGL textures, so the performance is as optimized as possible in the browser. timer.interval probably isn't the best approach as it can have a bit of latency in browser implementations, scheduleFrameCallback should provide a tighter update interval that aligns to frame boundaries. Having done something similar in the past with javascript and livekit and pixi.js, there might be a little work to get the browser to always render the frames. In our experience, the browser would skip rendering video frames if it thought the video was off screen. When we did this with pixi.js + webgl a year ago, we had to use alpha:0, pointer-events:none, on the video element so that the browser didn't stop rendering it (rather than display none or not putting it into the DOM at all). |
@eyebrowsoffire may be able to provide some additional guidance on the proper API usage for video elements. |
Calling scheduleFrameCallback in a loop of course could result in the texture getting updated a lot faster than the framerate of the video, here's an example of how it's done in pixi.js: While it checks if a frame is due on every frame tick, it does limit the FPS of the GPU updates so that it only updates when a new frame is due. Note they make use of the video specific call here for requestVideoFrameCallback which notifies when the next video frame update is available. |
thanks. |
See here for a PR I did for video_player_web to fix the same problem. Not too many lines of code. |
If you try to render more than 8 participants in web, each with a label rendered on top for it's name, the flutter web renderer will break due to using too many platform views.
A new change has landed in flutter designed to address this:
flutter/engine#45256
The web renderer should be modified so that it uses createImageBitmap to render each frame so that apps can render more than 8 video feeds without crashing the flutter renderer.
The text was updated successfully, but these errors were encountered: