@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.
@@ -197,6 +197,7 @@ declare class WebSocketStreamer {
197
197
  private bytesSent;
198
198
  private chunksSent;
199
199
  private userStopped;
200
+ private isHotSwapping;
200
201
  private startTime;
201
202
  private mimeType;
202
203
  private onBytesUpdate?;
@@ -197,6 +197,7 @@ declare class WebSocketStreamer {
197
197
  private bytesSent;
198
198
  private chunksSent;
199
199
  private userStopped;
200
+ private isHotSwapping;
200
201
  private startTime;
201
202
  private mimeType;
202
203
  private onBytesUpdate?;
@@ -1,4 +1,4 @@
1
1
  export { A as ApiClientConfig, h as AudioWaveform, B as Broadcast, C as CDN_DOMAIN, d as DIALTRIBE_API_BASE, c as DialtribeClient, a as DialtribeContextValue, i as DialtribeOverlay, k as DialtribeOverlayMode, j as DialtribeOverlayProps, e as DialtribePlayer, g as DialtribePlayerErrorBoundary, f as DialtribePlayerProps, D as DialtribeProvider, b as DialtribeProviderProps, E as ENDPOINTS, H as HTTP_STATUS, q as HttpStatusCode, L as LoadingSpinner, m as TranscriptData, l as TranscriptSegment, T as TranscriptWord, o as buildBroadcastCdnUrl, p as buildBroadcastS3KeyPrefix, n as formatTime, u as useDialtribe, r as useDialtribeOptional } from './dialtribe-player-CNriUtNi.mjs';
2
- export { j as DEFAULT_ENCODER_SERVER_URL, D as DialtribeStreamer, a as DialtribeStreamerProps, M as MediaConstraintsOptions, O as OpenDialtribeStreamerPopupOptions, P as PopupDimensions, w as PopupFallbackMode, f as StreamKeyDisplay, g as StreamKeyDisplayProps, h as StreamKeyInput, i as StreamKeyInputProps, e as StreamingControlState, c as StreamingControls, d as StreamingControlsProps, S as StreamingPreview, b as StreamingPreviewProps, t as UseDialtribeStreamerLauncherOptions, v as UseDialtribeStreamerLauncherReturn, U as UseDialtribeStreamerPopupReturn, W as WebSocketStreamer, k as WebSocketStreamerOptions, r as calculatePopupDimensions, o as checkBrowserCompatibility, m as getMediaConstraints, n as getMediaRecorderOptions, q as openBroadcastPopup, p as openDialtribeStreamerPopup, s as useDialtribeStreamerLauncher, u as useDialtribeStreamerPopup } from './dialtribe-streamer-Bc17hH6o.mjs';
2
+ export { j as DEFAULT_ENCODER_SERVER_URL, D as DialtribeStreamer, a as DialtribeStreamerProps, M as MediaConstraintsOptions, O as OpenDialtribeStreamerPopupOptions, P as PopupDimensions, w as PopupFallbackMode, f as StreamKeyDisplay, g as StreamKeyDisplayProps, h as StreamKeyInput, i as StreamKeyInputProps, e as StreamingControlState, c as StreamingControls, d as StreamingControlsProps, S as StreamingPreview, b as StreamingPreviewProps, t as UseDialtribeStreamerLauncherOptions, v as UseDialtribeStreamerLauncherReturn, U as UseDialtribeStreamerPopupReturn, W as WebSocketStreamer, k as WebSocketStreamerOptions, r as calculatePopupDimensions, o as checkBrowserCompatibility, m as getMediaConstraints, n as getMediaRecorderOptions, q as openBroadcastPopup, p as openDialtribeStreamerPopup, s as useDialtribeStreamerLauncher, u as useDialtribeStreamerPopup } from './dialtribe-streamer-CUKftBcx.mjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { A as ApiClientConfig, h as AudioWaveform, B as Broadcast, C as CDN_DOMAIN, d as DIALTRIBE_API_BASE, c as DialtribeClient, a as DialtribeContextValue, i as DialtribeOverlay, k as DialtribeOverlayMode, j as DialtribeOverlayProps, e as DialtribePlayer, g as DialtribePlayerErrorBoundary, f as DialtribePlayerProps, D as DialtribeProvider, b as DialtribeProviderProps, E as ENDPOINTS, H as HTTP_STATUS, q as HttpStatusCode, L as LoadingSpinner, m as TranscriptData, l as TranscriptSegment, T as TranscriptWord, o as buildBroadcastCdnUrl, p as buildBroadcastS3KeyPrefix, n as formatTime, u as useDialtribe, r as useDialtribeOptional } from './dialtribe-player-CNriUtNi.js';
2
- export { j as DEFAULT_ENCODER_SERVER_URL, D as DialtribeStreamer, a as DialtribeStreamerProps, M as MediaConstraintsOptions, O as OpenDialtribeStreamerPopupOptions, P as PopupDimensions, w as PopupFallbackMode, f as StreamKeyDisplay, g as StreamKeyDisplayProps, h as StreamKeyInput, i as StreamKeyInputProps, e as StreamingControlState, c as StreamingControls, d as StreamingControlsProps, S as StreamingPreview, b as StreamingPreviewProps, t as UseDialtribeStreamerLauncherOptions, v as UseDialtribeStreamerLauncherReturn, U as UseDialtribeStreamerPopupReturn, W as WebSocketStreamer, k as WebSocketStreamerOptions, r as calculatePopupDimensions, o as checkBrowserCompatibility, m as getMediaConstraints, n as getMediaRecorderOptions, q as openBroadcastPopup, p as openDialtribeStreamerPopup, s as useDialtribeStreamerLauncher, u as useDialtribeStreamerPopup } from './dialtribe-streamer-jgZX44_G.js';
2
+ export { j as DEFAULT_ENCODER_SERVER_URL, D as DialtribeStreamer, a as DialtribeStreamerProps, M as MediaConstraintsOptions, O as OpenDialtribeStreamerPopupOptions, P as PopupDimensions, w as PopupFallbackMode, f as StreamKeyDisplay, g as StreamKeyDisplayProps, h as StreamKeyInput, i as StreamKeyInputProps, e as StreamingControlState, c as StreamingControls, d as StreamingControlsProps, S as StreamingPreview, b as StreamingPreviewProps, t as UseDialtribeStreamerLauncherOptions, v as UseDialtribeStreamerLauncherReturn, U as UseDialtribeStreamerPopupReturn, W as WebSocketStreamer, k as WebSocketStreamerOptions, r as calculatePopupDimensions, o as checkBrowserCompatibility, m as getMediaConstraints, n as getMediaRecorderOptions, q as openBroadcastPopup, p as openDialtribeStreamerPopup, s as useDialtribeStreamerLauncher, u as useDialtribeStreamerPopup } from './dialtribe-streamer-DbXOuOHe.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -320,6 +320,8 @@ var WebSocketStreamer = class {
320
320
  this.chunksSent = 0;
321
321
  this.userStopped = false;
322
322
  // Track if user initiated the stop
323
+ this.isHotSwapping = false;
324
+ // Track if we're swapping media streams
323
325
  this.startTime = 0;
324
326
  this.streamKey = options.streamKey;
325
327
  this.mediaStream = options.mediaStream;
@@ -483,6 +485,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
483
485
  */
484
486
  async updateMediaStream(newMediaStream) {
485
487
  console.log("\u{1F504} Updating media stream (hot-swap)");
488
+ this.isHotSwapping = true;
486
489
  if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
487
490
  this.mediaRecorder.stop();
488
491
  console.log("\u23F9\uFE0F Old MediaRecorder stopped");
@@ -493,6 +496,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
493
496
  console.log("\u{1F399}\uFE0F New MediaRecorder created");
494
497
  this.setupMediaRecorderHandlers();
495
498
  this.mediaRecorder.start(300);
499
+ this.isHotSwapping = false;
496
500
  console.log("\u2705 Media stream updated - streaming continues");
497
501
  }
498
502
  /**
@@ -553,7 +557,7 @@ Please check encoder server logs and DATABASE_URL configuration.`
553
557
  });
554
558
  this.mediaRecorder.addEventListener("stop", () => {
555
559
  console.log("\u23F9\uFE0F MediaRecorder stopped");
556
- if (this.websocket?.readyState === WebSocket.OPEN) {
560
+ if (!this.isHotSwapping && this.websocket?.readyState === WebSocket.OPEN) {
557
561
  this.websocket.close();
558
562
  }
559
563
  });
@@ -1583,7 +1587,12 @@ function DialtribeStreamer({
1583
1587
  const audioInputs = devices.filter((device) => device.kind === "audioinput");
1584
1588
  console.log(`\u{1F4F7} Found ${videoInputs.length} video input device(s)`);
1585
1589
  console.log(`\u{1F3A4} Found ${audioInputs.length} audio input device(s)`);
1586
- setHasMultipleCameras(videoInputs.length > 1);
1590
+ const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
1591
+ const hasMultiple = videoInputs.length > 1 || isIOS && isVideoKey;
1592
+ setHasMultipleCameras(hasMultiple);
1593
+ if (isIOS && videoInputs.length <= 1) {
1594
+ console.log("\u{1F4F1} iOS device detected - assuming multiple cameras available");
1595
+ }
1587
1596
  setVideoDevices(videoInputs.map((d) => ({
1588
1597
  deviceId: d.deviceId,
1589
1598
  label: d.label || `Camera ${d.deviceId.slice(0, 8)}`
@@ -1600,7 +1609,8 @@ function DialtribeStreamer({
1600
1609
  }
1601
1610
  } catch (err) {
1602
1611
  console.error("\u274C Failed to enumerate devices:", err);
1603
- setHasMultipleCameras(false);
1612
+ const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
1613
+ setHasMultipleCameras(isIOS && isVideoKey);
1604
1614
  }
1605
1615
  };
1606
1616
  React2.useEffect(() => {
@@ -1634,7 +1644,7 @@ function DialtribeStreamer({
1634
1644
  if (videoRef.current && mediaStream) {
1635
1645
  videoRef.current.srcObject = mediaStream;
1636
1646
  }
1637
- }, [mediaStream]);
1647
+ }, [mediaStream, isVideoEnabled]);
1638
1648
  const requestMediaPermissions = async () => {
1639
1649
  if (!streamKey) return;
1640
1650
  try {