@dialtribe/react-sdk 0.1.0-alpha.11 → 0.1.0-alpha.14

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.
@@ -1,34 +1,34 @@
1
- export { A as ApiClientConfig, i as AudioWaveform, j as Broadcast, B as BroadcastPlayer, h as BroadcastPlayerErrorBoundary, f as BroadcastPlayerModal, g as BroadcastPlayerModalProps, e as BroadcastPlayerProps, C as CDN_DOMAIN, d as DIALTRIBE_API_BASE, c as DialTribeClient, a as DialTribeContextValue, D as DialTribeProvider, b as DialTribeProviderProps, E as ENDPOINTS, H as HTTP_STATUS, p as HttpStatusCode, L as LoadingSpinner, l as TranscriptData, k as TranscriptSegment, T as TranscriptWord, n as buildBroadcastCdnUrl, o as buildBroadcastS3KeyPrefix, m as formatTime, u as useDialTribe, q as useDialTribeOptional } from './broadcast-player-DnnXgWin.js';
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
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { RefObject } from 'react';
3
+ import React$1, { RefObject } from 'react';
4
4
 
5
5
  /**
6
- * Props for the BroadcastStreamer component.
6
+ * Props for the DialtribeStreamer component.
7
7
  *
8
8
  * @example
9
9
  * ```tsx
10
- * // Inside DialTribeProvider (recommended)
11
- * <DialTribeProvider sessionToken={token}>
12
- * <BroadcastStreamer
10
+ * // Inside DialtribeProvider (recommended)
11
+ * <DialtribeProvider sessionToken={token}>
12
+ * <DialtribeStreamer
13
13
  * streamKey={keyFromBackend}
14
14
  * onDone={() => window.close()}
15
15
  * />
16
- * </DialTribeProvider>
16
+ * </DialtribeProvider>
17
17
  *
18
18
  * // Standalone (e.g., popup window)
19
- * <BroadcastStreamer
19
+ * <DialtribeStreamer
20
20
  * sessionToken={token}
21
21
  * streamKey={keyFromBackend}
22
22
  * onDone={() => window.close()}
23
23
  * />
24
24
  * ```
25
25
  */
26
- interface BroadcastStreamerProps {
26
+ interface DialtribeStreamerProps {
27
27
  /**
28
28
  * Session token for API authentication.
29
29
  *
30
30
  * Required for permission checks. Can be provided via:
31
- * 1. DialTribeProvider context (recommended for main app)
31
+ * 1. DialtribeProvider context (recommended for main app)
32
32
  * 2. This prop (required for popup windows)
33
33
  *
34
34
  * Must include `broadcasts:stream` permission.
@@ -59,7 +59,7 @@ interface BroadcastStreamerProps {
59
59
  */
60
60
  onStreamKeyChange?: (key: string) => void;
61
61
  /**
62
- * Custom encoder server URL. Defaults to DialTribe's production encoder.
62
+ * Custom encoder server URL. Defaults to Dialtribe's production encoder.
63
63
  * Only change this for self-hosted encoder deployments.
64
64
  *
65
65
  * @default "https://broadcastapi.dialtribe.com"
@@ -80,7 +80,7 @@ interface BroadcastStreamerProps {
80
80
  */
81
81
  inline?: boolean;
82
82
  }
83
- declare function BroadcastStreamer({ sessionToken: propSessionToken, streamKey: initialStreamKey, onDone, onStreamKeyChange, encoderServerUrl, apiBaseUrl, inline, }: BroadcastStreamerProps): react_jsx_runtime.JSX.Element;
83
+ declare function DialtribeStreamer({ sessionToken: propSessionToken, streamKey: initialStreamKey, onDone, onStreamKeyChange, encoderServerUrl, apiBaseUrl, inline, }: DialtribeStreamerProps): react_jsx_runtime.JSX.Element;
84
84
 
85
85
  interface StreamingPreviewProps {
86
86
  videoRef: RefObject<HTMLVideoElement>;
@@ -267,11 +267,10 @@ interface PopupDimensions {
267
267
  * - Mobile/narrower screens: 9:16 portrait ratio (e.g., 720x1280) for vertical video
268
268
  */
269
269
  declare function calculatePopupDimensions(): PopupDimensions;
270
- type BroadcastMode = 'live' | 'schedule' | null;
271
270
  /**
272
271
  * Options for opening a broadcast streamer popup window.
273
272
  */
274
- interface OpenBroadcastStreamerPopupOptions {
273
+ interface OpenDialtribeStreamerPopupOptions {
275
274
  /**
276
275
  * Session token for API authentication. **Required.**
277
276
  * The token must include `broadcasts:stream` permission.
@@ -286,21 +285,18 @@ interface OpenBroadcastStreamerPopupOptions {
286
285
  * @example "w1_abc123def456..."
287
286
  */
288
287
  streamKey: string;
289
- /** Optional app ID to include in the postMessage payload */
290
- appId?: number;
291
288
  /**
292
- * Launch mode. Use 'live' for immediate streaming.
293
- * @default 'live'
289
+ * URL path for the streamer page. **Required.**
290
+ * This is the route in your app where the popup page is hosted.
291
+ *
292
+ * @example "/broadcasts/new"
293
+ * @example "/stream/live"
294
294
  */
295
- mode?: BroadcastMode;
295
+ streamerUrl: string;
296
+ /** Optional app ID to include in the postMessage payload */
297
+ appId?: number;
296
298
  /** Additional URL parameters to pass to the popup page */
297
299
  additionalParams?: Record<string, string>;
298
- /**
299
- * Base URL for the streamer page.
300
- * Only change this for custom hosting setups.
301
- * @default "/broadcasts/new"
302
- */
303
- baseUrl?: string;
304
300
  }
305
301
  /**
306
302
  * Open broadcast streamer popup window with credentials sent via postMessage
@@ -308,23 +304,198 @@ interface OpenBroadcastStreamerPopupOptions {
308
304
  *
309
305
  * @example
310
306
  * ```tsx
311
- * import { openBroadcastStreamerPopup } from '@dialtribe/react-sdk/broadcast-streamer';
307
+ * import { openDialtribeStreamerPopup } from '@dialtribe/react-sdk/dialtribe-streamer';
312
308
  *
313
309
  * // Open popup for live streaming
314
- * openBroadcastStreamerPopup({
310
+ * openDialtribeStreamerPopup({
315
311
  * sessionToken: 'sess_xxx...',
316
312
  * streamKey: 'w1_abc123...',
317
- * mode: 'live',
313
+ * streamerUrl: '/broadcasts/new',
318
314
  * });
319
315
  * ```
320
316
  *
321
317
  * @returns The popup window reference, or null if popup was blocked
322
318
  */
323
- declare function openBroadcastStreamerPopup(options: OpenBroadcastStreamerPopupOptions): Window | null;
319
+ declare function openDialtribeStreamerPopup(options: OpenDialtribeStreamerPopupOptions): Window | null;
324
320
  /**
325
321
  * Legacy function name for backwards compatibility
326
- * @deprecated Use openBroadcastStreamerPopup instead
322
+ * @deprecated Use openDialtribeStreamerPopup instead
323
+ */
324
+ declare const openBroadcastPopup: typeof openDialtribeStreamerPopup;
325
+
326
+ /**
327
+ * Return value from useDialtribeStreamerPopup hook.
328
+ */
329
+ interface UseDialtribeStreamerPopupReturn {
330
+ /**
331
+ * Session token received from parent window.
332
+ * Will be null until credentials are received via postMessage.
333
+ */
334
+ sessionToken: string | null;
335
+ /**
336
+ * Stream key received from parent window.
337
+ * Will be null until credentials are received via postMessage.
338
+ */
339
+ streamKey: string | null;
340
+ /**
341
+ * API base URL received from parent window.
342
+ * Defaults to empty string (uses SDK default).
343
+ */
344
+ apiBaseUrl: string;
345
+ /**
346
+ * Function to update the stream key.
347
+ * Pass this to DialtribeStreamer's onStreamKeyChange prop.
348
+ */
349
+ setStreamKey: React.Dispatch<React.SetStateAction<string | null>>;
350
+ /**
351
+ * True if credentials have been received from the parent window.
352
+ */
353
+ isReady: boolean;
354
+ }
355
+ /**
356
+ * Hook for popup pages that receive streaming credentials via postMessage.
357
+ *
358
+ * Use this in your popup page component to handle the postMessage communication
359
+ * with the parent window that opened the popup via `openDialtribeStreamerPopup()`.
360
+ *
361
+ * @example
362
+ * ```tsx
363
+ * import { DialtribeStreamer, useDialtribeStreamerPopup } from '@dialtribe/react-sdk/dialtribe-streamer';
364
+ *
365
+ * export default function BroadcastPopupPage() {
366
+ * const { sessionToken, streamKey, apiBaseUrl, setStreamKey } = useDialtribeStreamerPopup();
367
+ *
368
+ * return (
369
+ * <DialtribeStreamer
370
+ * sessionToken={sessionToken}
371
+ * streamKey={streamKey}
372
+ * apiBaseUrl={apiBaseUrl}
373
+ * onDone={() => window.close()}
374
+ * onStreamKeyChange={setStreamKey}
375
+ * />
376
+ * );
377
+ * }
378
+ * ```
379
+ */
380
+ declare function useDialtribeStreamerPopup(): UseDialtribeStreamerPopupReturn;
381
+
382
+ /**
383
+ * Fallback behavior when popup is blocked by the browser.
384
+ */
385
+ type PopupFallbackMode = 'fullscreen' | 'newTab' | 'none';
386
+ /**
387
+ * Options for the useDialtribeStreamerLauncher hook.
388
+ */
389
+ interface UseDialtribeStreamerLauncherOptions {
390
+ /**
391
+ * Session token for API authentication.
392
+ */
393
+ sessionToken: string | null;
394
+ /**
395
+ * Stream key for broadcasting.
396
+ */
397
+ streamKey: string;
398
+ /**
399
+ * URL path for the streamer page (e.g., '/broadcasts/new').
400
+ */
401
+ streamerUrl: string;
402
+ /**
403
+ * API base URL for the streamer.
404
+ */
405
+ apiBaseUrl?: string;
406
+ /**
407
+ * What to do if the popup is blocked by the browser.
408
+ * - 'fullscreen': Show a fullscreen overlay in the current page
409
+ * - 'newTab': Open in a new browser tab (less likely to be blocked)
410
+ * - 'none': Do nothing, let the caller handle it
411
+ *
412
+ * @default 'fullscreen'
413
+ */
414
+ fallback?: PopupFallbackMode;
415
+ /**
416
+ * Callback when popup is blocked (called regardless of fallback mode).
417
+ */
418
+ onPopupBlocked?: () => void;
419
+ /**
420
+ * Callback when streaming ends (from fullscreen fallback mode).
421
+ */
422
+ onDone?: () => void;
423
+ /**
424
+ * Callback when stream key changes (from fallback streamer).
425
+ */
426
+ onStreamKeyChange?: (key: string) => void;
427
+ }
428
+ /**
429
+ * Return value from useDialtribeStreamerLauncher hook.
430
+ */
431
+ interface UseDialtribeStreamerLauncherReturn {
432
+ /**
433
+ * Launch the streamer. Tries popup first, falls back if blocked.
434
+ */
435
+ launch: () => void;
436
+ /**
437
+ * Portal component that renders the fallback overlay.
438
+ * Include this once in your JSX - it renders via portal to document.body.
439
+ *
440
+ * @example
441
+ * ```tsx
442
+ * const { launch, Fallback } = useDialtribeStreamerLauncher({...});
443
+ * return (
444
+ * <>
445
+ * <button onClick={launch}>Start</button>
446
+ * <Fallback />
447
+ * </>
448
+ * );
449
+ * ```
450
+ */
451
+ Fallback: React$1.FC;
452
+ /**
453
+ * Whether the fallback fullscreen overlay is currently shown.
454
+ * Use this for custom fallback rendering.
455
+ */
456
+ showFallback: boolean;
457
+ /**
458
+ * Close the fallback overlay.
459
+ * Use this for custom fallback rendering.
460
+ */
461
+ closeFallback: () => void;
462
+ /**
463
+ * Reference to the popup window (if successfully opened).
464
+ */
465
+ popupRef: Window | null;
466
+ /**
467
+ * Whether the last launch attempt was blocked.
468
+ */
469
+ wasBlocked: boolean;
470
+ }
471
+ /**
472
+ * Hook for launching the DialtribeStreamer with automatic popup fallback.
473
+ *
474
+ * This hook tries to open the streamer in a popup window first. If the popup
475
+ * is blocked by the browser, it automatically falls back to a fullscreen
476
+ * overlay or new tab (configurable).
477
+ *
478
+ * @example
479
+ * ```tsx
480
+ * import { useDialtribeStreamerLauncher } from '@dialtribe/react-sdk/dialtribe-streamer';
481
+ *
482
+ * function StreamButton({ sessionToken, streamKey }: Props) {
483
+ * const { launch, Fallback } = useDialtribeStreamerLauncher({
484
+ * sessionToken,
485
+ * streamKey,
486
+ * streamerUrl: '/broadcasts/new',
487
+ * fallback: 'fullscreen',
488
+ * });
489
+ *
490
+ * return (
491
+ * <>
492
+ * <button onClick={launch}>Start Streaming</button>
493
+ * <Fallback />
494
+ * </>
495
+ * );
496
+ * }
497
+ * ```
327
498
  */
328
- declare const openBroadcastPopup: typeof openBroadcastStreamerPopup;
499
+ declare function useDialtribeStreamerLauncher(options: UseDialtribeStreamerLauncherOptions): UseDialtribeStreamerLauncherReturn;
329
500
 
330
- export { type BroadcastMode, BroadcastStreamer, type BroadcastStreamerProps, DEFAULT_ENCODER_SERVER_URL, type MediaConstraintsOptions, type OpenBroadcastStreamerPopupOptions, type PopupDimensions, StreamKeyDisplay, type StreamKeyDisplayProps, StreamKeyInput, type StreamKeyInputProps, type StreamingControlState, StreamingControls, type StreamingControlsProps, StreamingPreview, type StreamingPreviewProps, WebSocketStreamer, type WebSocketStreamerOptions, calculatePopupDimensions, checkBrowserCompatibility, getMediaConstraints, getMediaRecorderOptions, openBroadcastPopup, openBroadcastStreamerPopup };
501
+ export { DEFAULT_ENCODER_SERVER_URL, DialtribeStreamer, type DialtribeStreamerProps, type MediaConstraintsOptions, type OpenDialtribeStreamerPopupOptions, type PopupDimensions, type PopupFallbackMode, StreamKeyDisplay, type StreamKeyDisplayProps, StreamKeyInput, type StreamKeyInputProps, type StreamingControlState, StreamingControls, type StreamingControlsProps, StreamingPreview, type StreamingPreviewProps, type UseDialtribeStreamerLauncherOptions, type UseDialtribeStreamerLauncherReturn, type UseDialtribeStreamerPopupReturn, WebSocketStreamer, type WebSocketStreamerOptions, calculatePopupDimensions, checkBrowserCompatibility, getMediaConstraints, getMediaRecorderOptions, openBroadcastPopup, openDialtribeStreamerPopup, useDialtribeStreamerLauncher, useDialtribeStreamerPopup };
@@ -1,34 +1,34 @@
1
- export { A as ApiClientConfig, i as AudioWaveform, j as Broadcast, B as BroadcastPlayer, h as BroadcastPlayerErrorBoundary, f as BroadcastPlayerModal, g as BroadcastPlayerModalProps, e as BroadcastPlayerProps, C as CDN_DOMAIN, d as DIALTRIBE_API_BASE, c as DialTribeClient, a as DialTribeContextValue, D as DialTribeProvider, b as DialTribeProviderProps, E as ENDPOINTS, H as HTTP_STATUS, p as HttpStatusCode, L as LoadingSpinner, l as TranscriptData, k as TranscriptSegment, T as TranscriptWord, n as buildBroadcastCdnUrl, o as buildBroadcastS3KeyPrefix, m as formatTime, u as useDialTribe, q as useDialTribeOptional } from './broadcast-player-DnnXgWin.mjs';
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
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { RefObject } from 'react';
3
+ import React$1, { RefObject } from 'react';
4
4
 
5
5
  /**
6
- * Props for the BroadcastStreamer component.
6
+ * Props for the DialtribeStreamer component.
7
7
  *
8
8
  * @example
9
9
  * ```tsx
10
- * // Inside DialTribeProvider (recommended)
11
- * <DialTribeProvider sessionToken={token}>
12
- * <BroadcastStreamer
10
+ * // Inside DialtribeProvider (recommended)
11
+ * <DialtribeProvider sessionToken={token}>
12
+ * <DialtribeStreamer
13
13
  * streamKey={keyFromBackend}
14
14
  * onDone={() => window.close()}
15
15
  * />
16
- * </DialTribeProvider>
16
+ * </DialtribeProvider>
17
17
  *
18
18
  * // Standalone (e.g., popup window)
19
- * <BroadcastStreamer
19
+ * <DialtribeStreamer
20
20
  * sessionToken={token}
21
21
  * streamKey={keyFromBackend}
22
22
  * onDone={() => window.close()}
23
23
  * />
24
24
  * ```
25
25
  */
26
- interface BroadcastStreamerProps {
26
+ interface DialtribeStreamerProps {
27
27
  /**
28
28
  * Session token for API authentication.
29
29
  *
30
30
  * Required for permission checks. Can be provided via:
31
- * 1. DialTribeProvider context (recommended for main app)
31
+ * 1. DialtribeProvider context (recommended for main app)
32
32
  * 2. This prop (required for popup windows)
33
33
  *
34
34
  * Must include `broadcasts:stream` permission.
@@ -59,7 +59,7 @@ interface BroadcastStreamerProps {
59
59
  */
60
60
  onStreamKeyChange?: (key: string) => void;
61
61
  /**
62
- * Custom encoder server URL. Defaults to DialTribe's production encoder.
62
+ * Custom encoder server URL. Defaults to Dialtribe's production encoder.
63
63
  * Only change this for self-hosted encoder deployments.
64
64
  *
65
65
  * @default "https://broadcastapi.dialtribe.com"
@@ -80,7 +80,7 @@ interface BroadcastStreamerProps {
80
80
  */
81
81
  inline?: boolean;
82
82
  }
83
- declare function BroadcastStreamer({ sessionToken: propSessionToken, streamKey: initialStreamKey, onDone, onStreamKeyChange, encoderServerUrl, apiBaseUrl, inline, }: BroadcastStreamerProps): react_jsx_runtime.JSX.Element;
83
+ declare function DialtribeStreamer({ sessionToken: propSessionToken, streamKey: initialStreamKey, onDone, onStreamKeyChange, encoderServerUrl, apiBaseUrl, inline, }: DialtribeStreamerProps): react_jsx_runtime.JSX.Element;
84
84
 
85
85
  interface StreamingPreviewProps {
86
86
  videoRef: RefObject<HTMLVideoElement>;
@@ -267,11 +267,10 @@ interface PopupDimensions {
267
267
  * - Mobile/narrower screens: 9:16 portrait ratio (e.g., 720x1280) for vertical video
268
268
  */
269
269
  declare function calculatePopupDimensions(): PopupDimensions;
270
- type BroadcastMode = 'live' | 'schedule' | null;
271
270
  /**
272
271
  * Options for opening a broadcast streamer popup window.
273
272
  */
274
- interface OpenBroadcastStreamerPopupOptions {
273
+ interface OpenDialtribeStreamerPopupOptions {
275
274
  /**
276
275
  * Session token for API authentication. **Required.**
277
276
  * The token must include `broadcasts:stream` permission.
@@ -286,21 +285,18 @@ interface OpenBroadcastStreamerPopupOptions {
286
285
  * @example "w1_abc123def456..."
287
286
  */
288
287
  streamKey: string;
289
- /** Optional app ID to include in the postMessage payload */
290
- appId?: number;
291
288
  /**
292
- * Launch mode. Use 'live' for immediate streaming.
293
- * @default 'live'
289
+ * URL path for the streamer page. **Required.**
290
+ * This is the route in your app where the popup page is hosted.
291
+ *
292
+ * @example "/broadcasts/new"
293
+ * @example "/stream/live"
294
294
  */
295
- mode?: BroadcastMode;
295
+ streamerUrl: string;
296
+ /** Optional app ID to include in the postMessage payload */
297
+ appId?: number;
296
298
  /** Additional URL parameters to pass to the popup page */
297
299
  additionalParams?: Record<string, string>;
298
- /**
299
- * Base URL for the streamer page.
300
- * Only change this for custom hosting setups.
301
- * @default "/broadcasts/new"
302
- */
303
- baseUrl?: string;
304
300
  }
305
301
  /**
306
302
  * Open broadcast streamer popup window with credentials sent via postMessage
@@ -308,23 +304,198 @@ interface OpenBroadcastStreamerPopupOptions {
308
304
  *
309
305
  * @example
310
306
  * ```tsx
311
- * import { openBroadcastStreamerPopup } from '@dialtribe/react-sdk/broadcast-streamer';
307
+ * import { openDialtribeStreamerPopup } from '@dialtribe/react-sdk/dialtribe-streamer';
312
308
  *
313
309
  * // Open popup for live streaming
314
- * openBroadcastStreamerPopup({
310
+ * openDialtribeStreamerPopup({
315
311
  * sessionToken: 'sess_xxx...',
316
312
  * streamKey: 'w1_abc123...',
317
- * mode: 'live',
313
+ * streamerUrl: '/broadcasts/new',
318
314
  * });
319
315
  * ```
320
316
  *
321
317
  * @returns The popup window reference, or null if popup was blocked
322
318
  */
323
- declare function openBroadcastStreamerPopup(options: OpenBroadcastStreamerPopupOptions): Window | null;
319
+ declare function openDialtribeStreamerPopup(options: OpenDialtribeStreamerPopupOptions): Window | null;
324
320
  /**
325
321
  * Legacy function name for backwards compatibility
326
- * @deprecated Use openBroadcastStreamerPopup instead
322
+ * @deprecated Use openDialtribeStreamerPopup instead
323
+ */
324
+ declare const openBroadcastPopup: typeof openDialtribeStreamerPopup;
325
+
326
+ /**
327
+ * Return value from useDialtribeStreamerPopup hook.
328
+ */
329
+ interface UseDialtribeStreamerPopupReturn {
330
+ /**
331
+ * Session token received from parent window.
332
+ * Will be null until credentials are received via postMessage.
333
+ */
334
+ sessionToken: string | null;
335
+ /**
336
+ * Stream key received from parent window.
337
+ * Will be null until credentials are received via postMessage.
338
+ */
339
+ streamKey: string | null;
340
+ /**
341
+ * API base URL received from parent window.
342
+ * Defaults to empty string (uses SDK default).
343
+ */
344
+ apiBaseUrl: string;
345
+ /**
346
+ * Function to update the stream key.
347
+ * Pass this to DialtribeStreamer's onStreamKeyChange prop.
348
+ */
349
+ setStreamKey: React.Dispatch<React.SetStateAction<string | null>>;
350
+ /**
351
+ * True if credentials have been received from the parent window.
352
+ */
353
+ isReady: boolean;
354
+ }
355
+ /**
356
+ * Hook for popup pages that receive streaming credentials via postMessage.
357
+ *
358
+ * Use this in your popup page component to handle the postMessage communication
359
+ * with the parent window that opened the popup via `openDialtribeStreamerPopup()`.
360
+ *
361
+ * @example
362
+ * ```tsx
363
+ * import { DialtribeStreamer, useDialtribeStreamerPopup } from '@dialtribe/react-sdk/dialtribe-streamer';
364
+ *
365
+ * export default function BroadcastPopupPage() {
366
+ * const { sessionToken, streamKey, apiBaseUrl, setStreamKey } = useDialtribeStreamerPopup();
367
+ *
368
+ * return (
369
+ * <DialtribeStreamer
370
+ * sessionToken={sessionToken}
371
+ * streamKey={streamKey}
372
+ * apiBaseUrl={apiBaseUrl}
373
+ * onDone={() => window.close()}
374
+ * onStreamKeyChange={setStreamKey}
375
+ * />
376
+ * );
377
+ * }
378
+ * ```
379
+ */
380
+ declare function useDialtribeStreamerPopup(): UseDialtribeStreamerPopupReturn;
381
+
382
+ /**
383
+ * Fallback behavior when popup is blocked by the browser.
384
+ */
385
+ type PopupFallbackMode = 'fullscreen' | 'newTab' | 'none';
386
+ /**
387
+ * Options for the useDialtribeStreamerLauncher hook.
388
+ */
389
+ interface UseDialtribeStreamerLauncherOptions {
390
+ /**
391
+ * Session token for API authentication.
392
+ */
393
+ sessionToken: string | null;
394
+ /**
395
+ * Stream key for broadcasting.
396
+ */
397
+ streamKey: string;
398
+ /**
399
+ * URL path for the streamer page (e.g., '/broadcasts/new').
400
+ */
401
+ streamerUrl: string;
402
+ /**
403
+ * API base URL for the streamer.
404
+ */
405
+ apiBaseUrl?: string;
406
+ /**
407
+ * What to do if the popup is blocked by the browser.
408
+ * - 'fullscreen': Show a fullscreen overlay in the current page
409
+ * - 'newTab': Open in a new browser tab (less likely to be blocked)
410
+ * - 'none': Do nothing, let the caller handle it
411
+ *
412
+ * @default 'fullscreen'
413
+ */
414
+ fallback?: PopupFallbackMode;
415
+ /**
416
+ * Callback when popup is blocked (called regardless of fallback mode).
417
+ */
418
+ onPopupBlocked?: () => void;
419
+ /**
420
+ * Callback when streaming ends (from fullscreen fallback mode).
421
+ */
422
+ onDone?: () => void;
423
+ /**
424
+ * Callback when stream key changes (from fallback streamer).
425
+ */
426
+ onStreamKeyChange?: (key: string) => void;
427
+ }
428
+ /**
429
+ * Return value from useDialtribeStreamerLauncher hook.
430
+ */
431
+ interface UseDialtribeStreamerLauncherReturn {
432
+ /**
433
+ * Launch the streamer. Tries popup first, falls back if blocked.
434
+ */
435
+ launch: () => void;
436
+ /**
437
+ * Portal component that renders the fallback overlay.
438
+ * Include this once in your JSX - it renders via portal to document.body.
439
+ *
440
+ * @example
441
+ * ```tsx
442
+ * const { launch, Fallback } = useDialtribeStreamerLauncher({...});
443
+ * return (
444
+ * <>
445
+ * <button onClick={launch}>Start</button>
446
+ * <Fallback />
447
+ * </>
448
+ * );
449
+ * ```
450
+ */
451
+ Fallback: React$1.FC;
452
+ /**
453
+ * Whether the fallback fullscreen overlay is currently shown.
454
+ * Use this for custom fallback rendering.
455
+ */
456
+ showFallback: boolean;
457
+ /**
458
+ * Close the fallback overlay.
459
+ * Use this for custom fallback rendering.
460
+ */
461
+ closeFallback: () => void;
462
+ /**
463
+ * Reference to the popup window (if successfully opened).
464
+ */
465
+ popupRef: Window | null;
466
+ /**
467
+ * Whether the last launch attempt was blocked.
468
+ */
469
+ wasBlocked: boolean;
470
+ }
471
+ /**
472
+ * Hook for launching the DialtribeStreamer with automatic popup fallback.
473
+ *
474
+ * This hook tries to open the streamer in a popup window first. If the popup
475
+ * is blocked by the browser, it automatically falls back to a fullscreen
476
+ * overlay or new tab (configurable).
477
+ *
478
+ * @example
479
+ * ```tsx
480
+ * import { useDialtribeStreamerLauncher } from '@dialtribe/react-sdk/dialtribe-streamer';
481
+ *
482
+ * function StreamButton({ sessionToken, streamKey }: Props) {
483
+ * const { launch, Fallback } = useDialtribeStreamerLauncher({
484
+ * sessionToken,
485
+ * streamKey,
486
+ * streamerUrl: '/broadcasts/new',
487
+ * fallback: 'fullscreen',
488
+ * });
489
+ *
490
+ * return (
491
+ * <>
492
+ * <button onClick={launch}>Start Streaming</button>
493
+ * <Fallback />
494
+ * </>
495
+ * );
496
+ * }
497
+ * ```
327
498
  */
328
- declare const openBroadcastPopup: typeof openBroadcastStreamerPopup;
499
+ declare function useDialtribeStreamerLauncher(options: UseDialtribeStreamerLauncherOptions): UseDialtribeStreamerLauncherReturn;
329
500
 
330
- export { type BroadcastMode, BroadcastStreamer, type BroadcastStreamerProps, DEFAULT_ENCODER_SERVER_URL, type MediaConstraintsOptions, type OpenBroadcastStreamerPopupOptions, type PopupDimensions, StreamKeyDisplay, type StreamKeyDisplayProps, StreamKeyInput, type StreamKeyInputProps, type StreamingControlState, StreamingControls, type StreamingControlsProps, StreamingPreview, type StreamingPreviewProps, WebSocketStreamer, type WebSocketStreamerOptions, calculatePopupDimensions, checkBrowserCompatibility, getMediaConstraints, getMediaRecorderOptions, openBroadcastPopup, openBroadcastStreamerPopup };
501
+ export { DEFAULT_ENCODER_SERVER_URL, DialtribeStreamer, type DialtribeStreamerProps, type MediaConstraintsOptions, type OpenDialtribeStreamerPopupOptions, type PopupDimensions, type PopupFallbackMode, StreamKeyDisplay, type StreamKeyDisplayProps, StreamKeyInput, type StreamKeyInputProps, type StreamingControlState, StreamingControls, type StreamingControlsProps, StreamingPreview, type StreamingPreviewProps, type UseDialtribeStreamerLauncherOptions, type UseDialtribeStreamerLauncherReturn, type UseDialtribeStreamerPopupReturn, WebSocketStreamer, type WebSocketStreamerOptions, calculatePopupDimensions, checkBrowserCompatibility, getMediaConstraints, getMediaRecorderOptions, openBroadcastPopup, openDialtribeStreamerPopup, useDialtribeStreamerLauncher, useDialtribeStreamerPopup };