@poolse/react-native 2.13.0 → 2.14.0
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +35 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5449,6 +5449,11 @@ function LocalVideoPip({
|
|
|
5449
5449
|
const cornerRef = useRef(corner);
|
|
5450
5450
|
cornerRef.current = corner;
|
|
5451
5451
|
const dragged = useRef(false);
|
|
5452
|
+
useEffect(() => {
|
|
5453
|
+
if (dragged.current) return;
|
|
5454
|
+
const at = corners[corner];
|
|
5455
|
+
if (at) pan.setValue(at);
|
|
5456
|
+
}, [corners, corner, pan]);
|
|
5452
5457
|
const responder = useMemo(
|
|
5453
5458
|
() => PanResponder.create({
|
|
5454
5459
|
// Claim the gesture only once it is clearly a drag. A lower
|
|
@@ -5673,6 +5678,7 @@ function useCallAudio({
|
|
|
5673
5678
|
if (!active || !session) return;
|
|
5674
5679
|
const wantsSpeaker = preferSpeaker.current;
|
|
5675
5680
|
let disposePolicy;
|
|
5681
|
+
let released = false;
|
|
5676
5682
|
void (async () => {
|
|
5677
5683
|
try {
|
|
5678
5684
|
await session.configureAudio({
|
|
@@ -5686,14 +5692,22 @@ function useCallAudio({
|
|
|
5686
5692
|
});
|
|
5687
5693
|
} catch {
|
|
5688
5694
|
}
|
|
5695
|
+
if (released) return;
|
|
5689
5696
|
disposePolicy = livekitReactNative?.setupIOSAudioManagement?.(wantsSpeaker);
|
|
5690
5697
|
try {
|
|
5691
5698
|
await session.startAudioSession();
|
|
5692
5699
|
} catch {
|
|
5693
5700
|
}
|
|
5701
|
+
if (released) {
|
|
5702
|
+
void session.stopAudioSession().catch(() => {
|
|
5703
|
+
});
|
|
5704
|
+
disposePolicy?.();
|
|
5705
|
+
return;
|
|
5706
|
+
}
|
|
5694
5707
|
refreshRoutes();
|
|
5695
5708
|
})();
|
|
5696
5709
|
return () => {
|
|
5710
|
+
released = true;
|
|
5697
5711
|
void session.stopAudioSession().catch(() => {
|
|
5698
5712
|
});
|
|
5699
5713
|
disposePolicy?.();
|
|
@@ -5850,31 +5864,33 @@ function CallScreen({
|
|
|
5850
5864
|
});
|
|
5851
5865
|
const [routesOpen, setRoutesOpen] = useState(false);
|
|
5852
5866
|
const [chromeVisible, setChromeVisible] = useState(true);
|
|
5853
|
-
const
|
|
5867
|
+
const [lastWake, setLastWake] = useState(0);
|
|
5854
5868
|
const chromeHides = connected && isVideoCall;
|
|
5855
5869
|
useEffect(() => {
|
|
5856
|
-
if (!chromeHides) {
|
|
5857
|
-
setChromeVisible(true);
|
|
5858
|
-
return;
|
|
5859
|
-
}
|
|
5860
|
-
hideAt.current = Date.now() + CHROME_IDLE_MS;
|
|
5861
|
-
const timer = setInterval(() => {
|
|
5862
|
-
if (Date.now() >= hideAt.current) setChromeVisible(false);
|
|
5863
|
-
}, 500);
|
|
5864
|
-
return () => clearInterval(timer);
|
|
5865
|
-
}, [chromeHides, chromeVisible]);
|
|
5866
|
-
const wakeChrome = useCallback(() => {
|
|
5867
|
-
hideAt.current = Date.now() + CHROME_IDLE_MS;
|
|
5868
5870
|
setChromeVisible(true);
|
|
5869
|
-
|
|
5871
|
+
if (!chromeHides) return;
|
|
5872
|
+
const timer = setTimeout(() => setChromeVisible(false), CHROME_IDLE_MS);
|
|
5873
|
+
return () => clearTimeout(timer);
|
|
5874
|
+
}, [chromeHides, lastWake]);
|
|
5875
|
+
const wakeChrome = useCallback(() => setLastWake(Date.now()), []);
|
|
5876
|
+
const withWake = useCallback(
|
|
5877
|
+
(fn) => () => {
|
|
5878
|
+
wakeChrome();
|
|
5879
|
+
fn();
|
|
5880
|
+
},
|
|
5881
|
+
[wakeChrome]
|
|
5882
|
+
);
|
|
5870
5883
|
const hangUp = useCallback(() => {
|
|
5871
5884
|
sfu.leave();
|
|
5872
5885
|
mesh.leave();
|
|
5873
5886
|
void calls.hangUp();
|
|
5874
5887
|
}, [sfu, mesh, calls]);
|
|
5875
5888
|
const alone = usingSfu ? sfu.alone : mesh.alone;
|
|
5889
|
+
const endedOnEmpty = useRef(false);
|
|
5890
|
+
if (calls.phase !== "active") endedOnEmpty.current = false;
|
|
5876
5891
|
useEffect(() => {
|
|
5877
|
-
if (!alone || calls.phase !== "active") return;
|
|
5892
|
+
if (!alone || calls.phase !== "active" || endedOnEmpty.current) return;
|
|
5893
|
+
endedOnEmpty.current = true;
|
|
5878
5894
|
hangUp();
|
|
5879
5895
|
}, [alone, calls.phase, hangUp]);
|
|
5880
5896
|
const micOn = usingSfu ? sfu.micEnabled : !mesh.muted;
|
|
@@ -5985,7 +6001,7 @@ function CallScreen({
|
|
|
5985
6001
|
icon: micOn ? "mic" : "mic-off",
|
|
5986
6002
|
label: micOn ? "Mute" : "Unmute",
|
|
5987
6003
|
active: !micOn,
|
|
5988
|
-
onPress: toggleMic,
|
|
6004
|
+
onPress: withWake(toggleMic),
|
|
5989
6005
|
accessibilityLabel: micOn ? "Mute microphone" : "Unmute microphone"
|
|
5990
6006
|
}
|
|
5991
6007
|
),
|
|
@@ -5995,7 +6011,7 @@ function CallScreen({
|
|
|
5995
6011
|
icon: speakerIcon(audio),
|
|
5996
6012
|
label: speakerLabel(audio),
|
|
5997
6013
|
active: audio.speakerOn,
|
|
5998
|
-
onPress: onSpeakerPress,
|
|
6014
|
+
onPress: withWake(onSpeakerPress),
|
|
5999
6015
|
accessibilityLabel: "Audio output"
|
|
6000
6016
|
}
|
|
6001
6017
|
),
|
|
@@ -6005,7 +6021,7 @@ function CallScreen({
|
|
|
6005
6021
|
icon: videoOn ? "video" : "video-off",
|
|
6006
6022
|
label: "Camera",
|
|
6007
6023
|
active: !videoOn,
|
|
6008
|
-
onPress: () => void sfu.toggleCamera(),
|
|
6024
|
+
onPress: withWake(() => void sfu.toggleCamera()),
|
|
6009
6025
|
accessibilityLabel: videoOn ? "Turn camera off" : "Turn camera on"
|
|
6010
6026
|
}
|
|
6011
6027
|
),
|
|
@@ -6014,7 +6030,7 @@ function CallScreen({
|
|
|
6014
6030
|
{
|
|
6015
6031
|
icon: "camera-flip",
|
|
6016
6032
|
label: "Flip",
|
|
6017
|
-
onPress: () => void sfu.switchCamera(),
|
|
6033
|
+
onPress: withWake(() => void sfu.switchCamera()),
|
|
6018
6034
|
accessibilityLabel: "Switch camera"
|
|
6019
6035
|
}
|
|
6020
6036
|
)
|