Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -70,9 +70,27 @@ export function ShareButton({ variant = 'default', autoOpen, onHandleChange, onV
|
|||||||
streamRef.current = null;
|
streamRef.current = null;
|
||||||
setHandle(null);
|
setHandle(null);
|
||||||
setViewerCount(0);
|
setViewerCount(0);
|
||||||
|
onHandleChange?.(null);
|
||||||
|
onViewerCountChange?.(0);
|
||||||
toast.info('Transmissão encerrada');
|
toast.info('Transmissão encerrada');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Auto-open dialog when requested by parent (in-XR HUD)
|
||||||
|
useEffect(() => {
|
||||||
|
if (autoOpen) setOpen(true);
|
||||||
|
}, [autoOpen]);
|
||||||
|
|
||||||
|
// Expose start/stop via window so XR HUD can trigger from inside the scene
|
||||||
|
useEffect(() => {
|
||||||
|
(window as unknown as { __trackSteelStartLive?: () => void; __trackSteelStopLive?: () => void }).__trackSteelStartLive = () => { if (!handle) start(); };
|
||||||
|
(window as unknown as { __trackSteelStopLive?: () => void }).__trackSteelStopLive = () => { if (handle) stop(); };
|
||||||
|
return () => {
|
||||||
|
delete (window as unknown as { __trackSteelStartLive?: () => void }).__trackSteelStartLive;
|
||||||
|
delete (window as unknown as { __trackSteelStopLive?: () => void }).__trackSteelStopLive;
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [handle]);
|
||||||
|
|
||||||
// Cleanup on unmount
|
// Cleanup on unmount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user