agora-rtc-react
agora-rtc-react copied to clipboard
Video flickering on re-render
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!
@DasGandlaf Can you tell me what is your component look like?
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} />