agora-rtc-react icon indicating copy to clipboard operation
agora-rtc-react copied to clipboard

Video flickering on re-render

Open adambasis opened this issue 11 months ago • 2 comments

Hey,

I have a component that uses RemoterUser to render a remote video. When my component re-renders, all the videos disappear and re-appear, such as when muting or unmuting.

How can I fix this issue?

Thanks!

adambasis avatar Jan 25 '25 07:01 adambasis

@DasGandlaf Can you tell me what is your component look like?

guoxianzhe avatar Jan 26 '25 06:01 guoxianzhe

just don't pass a prop that is recreated every render.

❌ BAD

<RemoteUser user={remoteUser} videoPlayerConfig={{ fit: 'contain' }} />

✅ GOOD

const videoPlayerConfig = { fit: 'contain' };
// or
const videoPlayerConfig = useMemo(() => ({ fit: 'contain' }), []);

// component call
<RemoteUser user={remoteUser} videoPlayerConfig={videoPlayerConfig} />

redkean avatar Mar 20 '25 07:03 redkean