🐛(frontend) reset video ref on track stop for state transitions

Reset video element reference when track stops to ensure "camera
starting" to "camera started" message transitions work correctly on
repeated camera toggles.

Previously only worked on initial video element load. Now properly
handles state transitions for multiple camera enable/disable cycles.
This commit is contained in:
lebaudantoine
2025-08-11 13:56:23 +02:00
committed by aleb_the_flash
parent 56ec2dd8cb
commit 2d47e90a1a

View File

@@ -161,7 +161,11 @@ export const Join = ({
return () => {
videoTrack?.detach()
videoElement?.removeEventListener('loadedmetadata', handleVideoLoaded)
if (videoElement) {
videoElement.removeEventListener('loadedmetadata', handleVideoLoaded)
videoElement.style.opacity = '0'
}
isVideoInitiated.current = false
}
}, [videoTrack, videoEnabled])