Issue Description
After a client leaves an active video room and subsequently joins a new room, a brief visual flash of the final video frame from the previous session appears on the screen. This residual frame displays momentarily on the local rendering view before the new video stream successfully renders.
Platform/SDK
Operating System: Android
Service: Agora RTC SDK
Root Cause
The visual artifact occurs because the local video renderer retains the last rendered frame from the previous session within its memory buffer. When the application reuses the same rendering view for a new channel connection without explicitly clearing the binding, the stale frame renders immediately upon surface initialization. This causes a momentary flash of outdated content before the newly established media stream overwrites the buffer.
Step-by-Step Solution
Halt the Video Preview Early
Stop the local video preview explicitly before initiating the sequence to leave the current channel. This prevents the camera from pushing new frames into the buffer during the teardown phase.
Purge the Rendering Canvas via Standard API
Utilize the standard video setup interface to unbind the view and clear the retained frame. Reconfigure the video canvas mode to the designated remove state before switching rooms.
Implement the following logic to clear the local video canvas:
canvasTag.canvas.setupMode = VideoCanvas.VIEW_SETUP_MODE_REMOVE val code = rtcEngineEx.setupLocalVideo(canvasTag.canvas)Execute the Room Transition
Proceed with the
leaveChanneland subsequentjoinChanneloperations only after the rendering canvas has been completely unbound and cleared.Validate the Clean Transition
Test the room switching workflow to verify that the transition between different rooms occurs smoothly. The local view should display a clean state without any flashing artifacts from the preceding session.
Best Practice
To ensure seamless visual transitions between video channels, applications must explicitly unbind and clear the rendering canvas during the teardown phase of the initial session. Relying on default garbage collection or overriding the view without clearing the canvas setup mode leads to residual frame retention and degraded visual experiences.