@limrun/ui 0.13.6 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +531 -519
- package/package.json +1 -1
- package/src/components/remote-control.tsx +28 -1
package/package.json
CHANGED
|
@@ -345,6 +345,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
345
345
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
346
346
|
const frameRef = useRef<HTMLImageElement>(null);
|
|
347
347
|
const [videoLoaded, setVideoLoaded] = useState(false);
|
|
348
|
+
const [unmuted, setUnmuted] = useState(false);
|
|
348
349
|
const [retryExhausted, setRetryExhausted] = useState(false);
|
|
349
350
|
const [isLandscape, setIsLandscape] = useState(false);
|
|
350
351
|
const [useAndroidTabletFrame, setUseAndroidTabletFrame] = useState(false);
|
|
@@ -477,11 +478,33 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
477
478
|
const platform = useMemo(() => detectPlatform(url), [url]);
|
|
478
479
|
const config = deviceConfig[platform];
|
|
479
480
|
|
|
481
|
+
useEffect(() => {
|
|
482
|
+
setUnmuted(false);
|
|
483
|
+
if (videoRef.current) {
|
|
484
|
+
videoRef.current.muted = true;
|
|
485
|
+
}
|
|
486
|
+
}, [platform, url]);
|
|
487
|
+
|
|
480
488
|
const updateStatus = (message: string) => {
|
|
481
489
|
// Use the wrapper for conditional logging
|
|
482
490
|
debugLog(message);
|
|
483
491
|
};
|
|
484
492
|
|
|
493
|
+
const unmute = () => {
|
|
494
|
+
if (unmuted) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
setUnmuted(true);
|
|
499
|
+
const video = videoRef.current;
|
|
500
|
+
if (video) {
|
|
501
|
+
video.muted = false;
|
|
502
|
+
video.play().catch((err: unknown) => {
|
|
503
|
+
debugWarn('Unable to unmute after user interaction:', err);
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
|
|
485
508
|
const sendBinaryControlMessage = (data: ArrayBuffer) => {
|
|
486
509
|
if (!dataChannelRef.current || dataChannelRef.current.readyState !== 'open') {
|
|
487
510
|
return;
|
|
@@ -964,6 +987,10 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
964
987
|
event.preventDefault();
|
|
965
988
|
event.stopPropagation();
|
|
966
989
|
|
|
990
|
+
if (event.type === 'mousedown' || event.type === 'touchstart') {
|
|
991
|
+
unmute();
|
|
992
|
+
}
|
|
993
|
+
|
|
967
994
|
// Compute mapping context once per event (reused for all pointers)
|
|
968
995
|
const ctx = computeVideoMappingContext();
|
|
969
996
|
|
|
@@ -2505,7 +2532,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
2505
2532
|
}}
|
|
2506
2533
|
autoPlay
|
|
2507
2534
|
playsInline
|
|
2508
|
-
muted
|
|
2535
|
+
muted={!unmuted}
|
|
2509
2536
|
tabIndex={0}
|
|
2510
2537
|
onKeyDown={handleKeyboard}
|
|
2511
2538
|
onKeyUp={handleKeyboard}
|