@dialtribe/react-sdk 0.1.0-alpha.15 → 0.1.0-alpha.17
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/{dialtribe-streamer-Bc17hH6o.d.mts → dialtribe-streamer-CUKftBcx.d.mts} +1 -0
- package/dist/{dialtribe-streamer-jgZX44_G.d.ts → dialtribe-streamer-DbXOuOHe.d.ts} +1 -0
- package/dist/dialtribe-streamer.d.mts +1 -1
- package/dist/dialtribe-streamer.d.ts +1 -1
- package/dist/dialtribe-streamer.js +14 -4
- package/dist/dialtribe-streamer.js.map +1 -1
- package/dist/dialtribe-streamer.mjs +14 -4
- package/dist/dialtribe-streamer.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2263,6 +2263,8 @@ var WebSocketStreamer = class {
|
|
|
2263
2263
|
this.chunksSent = 0;
|
|
2264
2264
|
this.userStopped = false;
|
|
2265
2265
|
// Track if user initiated the stop
|
|
2266
|
+
this.isHotSwapping = false;
|
|
2267
|
+
// Track if we're swapping media streams
|
|
2266
2268
|
this.startTime = 0;
|
|
2267
2269
|
this.streamKey = options.streamKey;
|
|
2268
2270
|
this.mediaStream = options.mediaStream;
|
|
@@ -2426,6 +2428,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
2426
2428
|
*/
|
|
2427
2429
|
async updateMediaStream(newMediaStream) {
|
|
2428
2430
|
console.log("\u{1F504} Updating media stream (hot-swap)");
|
|
2431
|
+
this.isHotSwapping = true;
|
|
2429
2432
|
if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
2430
2433
|
this.mediaRecorder.stop();
|
|
2431
2434
|
console.log("\u23F9\uFE0F Old MediaRecorder stopped");
|
|
@@ -2436,6 +2439,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
2436
2439
|
console.log("\u{1F399}\uFE0F New MediaRecorder created");
|
|
2437
2440
|
this.setupMediaRecorderHandlers();
|
|
2438
2441
|
this.mediaRecorder.start(300);
|
|
2442
|
+
this.isHotSwapping = false;
|
|
2439
2443
|
console.log("\u2705 Media stream updated - streaming continues");
|
|
2440
2444
|
}
|
|
2441
2445
|
/**
|
|
@@ -2496,7 +2500,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
2496
2500
|
});
|
|
2497
2501
|
this.mediaRecorder.addEventListener("stop", () => {
|
|
2498
2502
|
console.log("\u23F9\uFE0F MediaRecorder stopped");
|
|
2499
|
-
if (this.websocket?.readyState === WebSocket.OPEN) {
|
|
2503
|
+
if (!this.isHotSwapping && this.websocket?.readyState === WebSocket.OPEN) {
|
|
2500
2504
|
this.websocket.close();
|
|
2501
2505
|
}
|
|
2502
2506
|
});
|
|
@@ -3162,7 +3166,12 @@ function DialtribeStreamer({
|
|
|
3162
3166
|
const audioInputs = devices.filter((device) => device.kind === "audioinput");
|
|
3163
3167
|
console.log(`\u{1F4F7} Found ${videoInputs.length} video input device(s)`);
|
|
3164
3168
|
console.log(`\u{1F3A4} Found ${audioInputs.length} audio input device(s)`);
|
|
3165
|
-
|
|
3169
|
+
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
3170
|
+
const hasMultiple = videoInputs.length > 1 || isIOS && isVideoKey;
|
|
3171
|
+
setHasMultipleCameras(hasMultiple);
|
|
3172
|
+
if (isIOS && videoInputs.length <= 1) {
|
|
3173
|
+
console.log("\u{1F4F1} iOS device detected - assuming multiple cameras available");
|
|
3174
|
+
}
|
|
3166
3175
|
setVideoDevices(videoInputs.map((d) => ({
|
|
3167
3176
|
deviceId: d.deviceId,
|
|
3168
3177
|
label: d.label || `Camera ${d.deviceId.slice(0, 8)}`
|
|
@@ -3179,7 +3188,8 @@ function DialtribeStreamer({
|
|
|
3179
3188
|
}
|
|
3180
3189
|
} catch (err) {
|
|
3181
3190
|
console.error("\u274C Failed to enumerate devices:", err);
|
|
3182
|
-
|
|
3191
|
+
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
3192
|
+
setHasMultipleCameras(isIOS && isVideoKey);
|
|
3183
3193
|
}
|
|
3184
3194
|
};
|
|
3185
3195
|
useEffect(() => {
|
|
@@ -3213,7 +3223,7 @@ function DialtribeStreamer({
|
|
|
3213
3223
|
if (videoRef.current && mediaStream) {
|
|
3214
3224
|
videoRef.current.srcObject = mediaStream;
|
|
3215
3225
|
}
|
|
3216
|
-
}, [mediaStream]);
|
|
3226
|
+
}, [mediaStream, isVideoEnabled]);
|
|
3217
3227
|
const requestMediaPermissions = async () => {
|
|
3218
3228
|
if (!streamKey) return;
|
|
3219
3229
|
try {
|