video-saas-client 0.1.5 → 0.1.6
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.js +2 -11
- package/dist/index.mjs +2 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14968,7 +14968,6 @@ function useVideoCall(roomId, options = {}) {
|
|
|
14968
14968
|
const sendTransportRef = (0, import_react.useRef)(null);
|
|
14969
14969
|
const recvTransportRef = (0, import_react.useRef)(null);
|
|
14970
14970
|
const localStreamRef = (0, import_react.useRef)(null);
|
|
14971
|
-
const videoProducerRef = (0, import_react.useRef)(null);
|
|
14972
14971
|
const recordingIdsRef = (0, import_react.useRef)({ doctor: null, patient: null });
|
|
14973
14972
|
(0, import_react.useEffect)(() => {
|
|
14974
14973
|
if (!roomId) return;
|
|
@@ -15045,8 +15044,7 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15045
15044
|
}
|
|
15046
15045
|
setLocalStream(stream);
|
|
15047
15046
|
for (const track of stream.getTracks()) {
|
|
15048
|
-
|
|
15049
|
-
if (track.kind === "video") videoProducerRef.current = producer;
|
|
15047
|
+
await sendTransport.produce({ track });
|
|
15050
15048
|
}
|
|
15051
15049
|
return stream;
|
|
15052
15050
|
}
|
|
@@ -15120,13 +15118,7 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15120
15118
|
cancelled = true;
|
|
15121
15119
|
cleanup();
|
|
15122
15120
|
};
|
|
15123
|
-
}, [roomId, token]);
|
|
15124
|
-
(0, import_react.useEffect)(() => {
|
|
15125
|
-
if (!videoTrack || !videoProducerRef.current) return;
|
|
15126
|
-
videoProducerRef.current.replaceTrack({ track: videoTrack }).catch((err) => {
|
|
15127
|
-
console.error("[video-saas-client] replaceTrack failed:", err);
|
|
15128
|
-
});
|
|
15129
|
-
}, [videoTrack]);
|
|
15121
|
+
}, [roomId, token, videoTrack]);
|
|
15130
15122
|
function cleanup() {
|
|
15131
15123
|
localStreamRef.current?.getTracks().forEach((t) => t.stop());
|
|
15132
15124
|
sendTransportRef.current?.close();
|
|
@@ -15137,7 +15129,6 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15137
15129
|
sendTransportRef.current = null;
|
|
15138
15130
|
recvTransportRef.current = null;
|
|
15139
15131
|
localStreamRef.current = null;
|
|
15140
|
-
videoProducerRef.current = null;
|
|
15141
15132
|
}
|
|
15142
15133
|
function leaveRoom() {
|
|
15143
15134
|
cleanup();
|
package/dist/index.mjs
CHANGED
|
@@ -14960,7 +14960,6 @@ function useVideoCall(roomId, options = {}) {
|
|
|
14960
14960
|
const sendTransportRef = useRef(null);
|
|
14961
14961
|
const recvTransportRef = useRef(null);
|
|
14962
14962
|
const localStreamRef = useRef(null);
|
|
14963
|
-
const videoProducerRef = useRef(null);
|
|
14964
14963
|
const recordingIdsRef = useRef({ doctor: null, patient: null });
|
|
14965
14964
|
useEffect(() => {
|
|
14966
14965
|
if (!roomId) return;
|
|
@@ -15037,8 +15036,7 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15037
15036
|
}
|
|
15038
15037
|
setLocalStream(stream);
|
|
15039
15038
|
for (const track of stream.getTracks()) {
|
|
15040
|
-
|
|
15041
|
-
if (track.kind === "video") videoProducerRef.current = producer;
|
|
15039
|
+
await sendTransport.produce({ track });
|
|
15042
15040
|
}
|
|
15043
15041
|
return stream;
|
|
15044
15042
|
}
|
|
@@ -15112,13 +15110,7 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15112
15110
|
cancelled = true;
|
|
15113
15111
|
cleanup();
|
|
15114
15112
|
};
|
|
15115
|
-
}, [roomId, token]);
|
|
15116
|
-
useEffect(() => {
|
|
15117
|
-
if (!videoTrack || !videoProducerRef.current) return;
|
|
15118
|
-
videoProducerRef.current.replaceTrack({ track: videoTrack }).catch((err) => {
|
|
15119
|
-
console.error("[video-saas-client] replaceTrack failed:", err);
|
|
15120
|
-
});
|
|
15121
|
-
}, [videoTrack]);
|
|
15113
|
+
}, [roomId, token, videoTrack]);
|
|
15122
15114
|
function cleanup() {
|
|
15123
15115
|
localStreamRef.current?.getTracks().forEach((t) => t.stop());
|
|
15124
15116
|
sendTransportRef.current?.close();
|
|
@@ -15129,7 +15121,6 @@ function useVideoCall(roomId, options = {}) {
|
|
|
15129
15121
|
sendTransportRef.current = null;
|
|
15130
15122
|
recvTransportRef.current = null;
|
|
15131
15123
|
localStreamRef.current = null;
|
|
15132
|
-
videoProducerRef.current = null;
|
|
15133
15124
|
}
|
|
15134
15125
|
function leaveRoom() {
|
|
15135
15126
|
cleanup();
|