Flickrs happening when toggling full screen view

Video SDK version

We are using Full Screen API (Fullscreen API - Web APIs | MDN) whenever the user clicks on full screen button.

But even though the containers adapt to the full screen dimensions, the video remains in the same dimensions as that of small screen for a while and then readapts to the new dimension. (on change of canvas dimensions, we are triggering updateCanvasDimensions with the new height and width).

But this is causing visible flickrs on the screen. Could you please share the best practice around this problem we are facing.