@limrun/ui 0.4.0-rc.3 → 0.4.0-rc.5
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.css +1 -1
- package/dist/index.js +273 -268
- package/package.json +1 -1
- package/src/components/remote-control.css +4 -0
- package/src/components/remote-control.tsx +11 -2
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useMemo, useState, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import './remote-control.css';
|
|
4
4
|
|
|
@@ -134,6 +134,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
134
134
|
({ className, url, token, sessionId: propSessionId, openUrl }: RemoteControlProps, ref) => {
|
|
135
135
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
136
136
|
const frameRef = useRef<HTMLImageElement>(null);
|
|
137
|
+
const [videoLoaded, setVideoLoaded] = useState(false);
|
|
137
138
|
const wsRef = useRef<WebSocket | null>(null);
|
|
138
139
|
const peerConnectionRef = useRef<RTCPeerConnection | null>(null);
|
|
139
140
|
const dataChannelRef = useRef<RTCDataChannel | null>(null);
|
|
@@ -752,6 +753,9 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
752
753
|
};
|
|
753
754
|
|
|
754
755
|
useEffect(() => {
|
|
756
|
+
// Reset video loaded state when connection params change
|
|
757
|
+
setVideoLoaded(false);
|
|
758
|
+
|
|
755
759
|
// Start connection when component mounts
|
|
756
760
|
start();
|
|
757
761
|
|
|
@@ -932,7 +936,11 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
932
936
|
/>
|
|
933
937
|
<video
|
|
934
938
|
ref={videoRef}
|
|
935
|
-
className={clsx(
|
|
939
|
+
className={clsx(
|
|
940
|
+
'rc-video',
|
|
941
|
+
platform === 'ios' ? 'rc-video-ios' : 'rc-video-android',
|
|
942
|
+
!videoLoaded && 'rc-video-loading',
|
|
943
|
+
)}
|
|
936
944
|
style={
|
|
937
945
|
config.loadingLogo
|
|
938
946
|
? {
|
|
@@ -950,6 +958,7 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
950
958
|
onKeyDown={handleKeyboard}
|
|
951
959
|
onKeyUp={handleKeyboard}
|
|
952
960
|
onClick={handleVideoClick}
|
|
961
|
+
onLoadedMetadata={() => setVideoLoaded(true)}
|
|
953
962
|
onFocus={() => {
|
|
954
963
|
if (videoRef.current) {
|
|
955
964
|
videoRef.current.style.outline = 'none';
|