@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
|
@@ -313,6 +313,8 @@ var WebSocketStreamer = class {
|
|
|
313
313
|
this.chunksSent = 0;
|
|
314
314
|
this.userStopped = false;
|
|
315
315
|
// Track if user initiated the stop
|
|
316
|
+
this.isHotSwapping = false;
|
|
317
|
+
// Track if we're swapping media streams
|
|
316
318
|
this.startTime = 0;
|
|
317
319
|
this.streamKey = options.streamKey;
|
|
318
320
|
this.mediaStream = options.mediaStream;
|
|
@@ -476,6 +478,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
476
478
|
*/
|
|
477
479
|
async updateMediaStream(newMediaStream) {
|
|
478
480
|
console.log("\u{1F504} Updating media stream (hot-swap)");
|
|
481
|
+
this.isHotSwapping = true;
|
|
479
482
|
if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
|
|
480
483
|
this.mediaRecorder.stop();
|
|
481
484
|
console.log("\u23F9\uFE0F Old MediaRecorder stopped");
|
|
@@ -486,6 +489,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
486
489
|
console.log("\u{1F399}\uFE0F New MediaRecorder created");
|
|
487
490
|
this.setupMediaRecorderHandlers();
|
|
488
491
|
this.mediaRecorder.start(300);
|
|
492
|
+
this.isHotSwapping = false;
|
|
489
493
|
console.log("\u2705 Media stream updated - streaming continues");
|
|
490
494
|
}
|
|
491
495
|
/**
|
|
@@ -546,7 +550,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
|
|
|
546
550
|
});
|
|
547
551
|
this.mediaRecorder.addEventListener("stop", () => {
|
|
548
552
|
console.log("\u23F9\uFE0F MediaRecorder stopped");
|
|
549
|
-
if (this.websocket?.readyState === WebSocket.OPEN) {
|
|
553
|
+
if (!this.isHotSwapping && this.websocket?.readyState === WebSocket.OPEN) {
|
|
550
554
|
this.websocket.close();
|
|
551
555
|
}
|
|
552
556
|
});
|
|
@@ -1576,7 +1580,12 @@ function DialtribeStreamer({
|
|
|
1576
1580
|
const audioInputs = devices.filter((device) => device.kind === "audioinput");
|
|
1577
1581
|
console.log(`\u{1F4F7} Found ${videoInputs.length} video input device(s)`);
|
|
1578
1582
|
console.log(`\u{1F3A4} Found ${audioInputs.length} audio input device(s)`);
|
|
1579
|
-
|
|
1583
|
+
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
1584
|
+
const hasMultiple = videoInputs.length > 1 || isIOS && isVideoKey;
|
|
1585
|
+
setHasMultipleCameras(hasMultiple);
|
|
1586
|
+
if (isIOS && videoInputs.length <= 1) {
|
|
1587
|
+
console.log("\u{1F4F1} iOS device detected - assuming multiple cameras available");
|
|
1588
|
+
}
|
|
1580
1589
|
setVideoDevices(videoInputs.map((d) => ({
|
|
1581
1590
|
deviceId: d.deviceId,
|
|
1582
1591
|
label: d.label || `Camera ${d.deviceId.slice(0, 8)}`
|
|
@@ -1593,7 +1602,8 @@ function DialtribeStreamer({
|
|
|
1593
1602
|
}
|
|
1594
1603
|
} catch (err) {
|
|
1595
1604
|
console.error("\u274C Failed to enumerate devices:", err);
|
|
1596
|
-
|
|
1605
|
+
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
1606
|
+
setHasMultipleCameras(isIOS && isVideoKey);
|
|
1597
1607
|
}
|
|
1598
1608
|
};
|
|
1599
1609
|
useEffect(() => {
|
|
@@ -1627,7 +1637,7 @@ function DialtribeStreamer({
|
|
|
1627
1637
|
if (videoRef.current && mediaStream) {
|
|
1628
1638
|
videoRef.current.srcObject = mediaStream;
|
|
1629
1639
|
}
|
|
1630
|
-
}, [mediaStream]);
|
|
1640
|
+
}, [mediaStream, isVideoEnabled]);
|
|
1631
1641
|
const requestMediaPermissions = async () => {
|
|
1632
1642
|
if (!streamKey) return;
|
|
1633
1643
|
try {
|