@cometchat/calls-sdk-react-native 5.0.1 → 5.0.2

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.d.ts CHANGED
@@ -114,6 +114,8 @@ declare const EVENT_LISTENER_METHODS: {
114
114
  readonly onSessionLeft: "onSessionLeft";
115
115
  readonly onConnectionLost: "onConnectionLost";
116
116
  readonly onConnectionRestored: "onConnectionRestored";
117
+ readonly onRemoteConnectionLost: "onRemoteConnectionLost";
118
+ readonly onRemoteConnectionRestored: "onRemoteConnectionRestored";
117
119
  readonly onConnectionClosed: "onConnectionClosed";
118
120
  readonly onConnectionFailed: "onConnectionFailed";
119
121
  readonly onSessionTimedOut: "onSessionTimedOut";
@@ -184,6 +186,8 @@ declare const EVENT_LISTENER_METHODS_WEB: {
184
186
  readonly onSessionLeft: "onSessionLeft";
185
187
  readonly onConnectionLost: "onConnectionLost";
186
188
  readonly onConnectionRestored: "onConnectionRestored";
189
+ readonly onRemoteConnectionLost: "onRemoteConnectionLost";
190
+ readonly onRemoteConnectionRestored: "onRemoteConnectionRestored";
187
191
  readonly onConnectionClosed: "onConnectionClosed";
188
192
  readonly onConnectionFailed: "onConnectionFailed";
189
193
  readonly onSessionTimedOut: "onSessionTimedOut";
@@ -225,6 +229,7 @@ declare const EVENT_LISTENER_METHODS_WEB: {
225
229
  declare const EVENT_LISTENER_METHODS_MOBILE: {
226
230
  readonly MediaEventsListener: {
227
231
  readonly onAudioModeChanged: "onAudioModeChanged";
232
+ readonly onAudioModesChanged: "onAudioModesChanged";
228
233
  readonly onCameraFacingChanged: "onCameraFacingChanged";
229
234
  readonly onAudioMuted: "onAudioMuted";
230
235
  readonly onAudioUnMuted: "onAudioUnMuted";
@@ -260,6 +265,8 @@ declare const EVENT_LISTENER_METHODS_MOBILE: {
260
265
  readonly onSessionLeft: "onSessionLeft";
261
266
  readonly onConnectionLost: "onConnectionLost";
262
267
  readonly onConnectionRestored: "onConnectionRestored";
268
+ readonly onRemoteConnectionLost: "onRemoteConnectionLost";
269
+ readonly onRemoteConnectionRestored: "onRemoteConnectionRestored";
263
270
  readonly onConnectionClosed: "onConnectionClosed";
264
271
  readonly onConnectionFailed: "onConnectionFailed";
265
272
  readonly onSessionTimedOut: "onSessionTimedOut";
@@ -310,6 +317,7 @@ type VideoInputDevice = MediaDeviceInfo & {
310
317
  type Subscription = (() => void) | {
311
318
  remove: () => void;
312
319
  };
320
+ type SettingsDialogTab = 'audio' | 'video';
313
321
  type BaseState = {
314
322
  participantListVisible: boolean;
315
323
  moreMenuVisible: boolean;
@@ -334,6 +342,7 @@ type BaseState = {
334
342
  cameraFacing: CameraFacingInternal;
335
343
  connectionRetryCount: number;
336
344
  settingsDialogVisible: boolean;
345
+ settingsDialogTab: SettingsDialogTab;
337
346
  virtualBackgroundDialogVisible: boolean;
338
347
  idealTimeoutTimer?: NodeJS.Timeout;
339
348
  idleTimeoutModalVisible: boolean;
@@ -420,7 +429,7 @@ declare const setLayout: (layout: Layout, sidebarLayoutSetProgrammatically?: boo
420
429
  declare const hideAllBottomSheets: () => void;
421
430
  declare const enablePictureInPictureLayout: () => void;
422
431
  declare const disablePictureInPictureLayout: () => void;
423
- declare const showSettingsDialog: () => void;
432
+ declare const showSettingsDialog: (tab?: SettingsDialogTab) => void;
424
433
  declare const hideSettingsDialog: () => void;
425
434
  declare const toggleSettingsDialog: () => void;
426
435
  declare const showVirtualBackgroundDialog: () => void;
@@ -428,7 +437,7 @@ declare const hideVirtualBackgroundDialog: () => void;
428
437
  declare const toggleMirrorLocalVideo: () => void;
429
438
  declare const toggleEnableNoiseReduction: () => void;
430
439
  declare const setChatButtonUnreadCount: (count: number) => void;
431
- declare const setAudioMode: (mode: AudioMode["type"]) => void;
440
+ declare const setAudioModes: (modes: AudioMode[]) => void;
432
441
  declare const getLayout: () => Layout;
433
442
  declare function initBaseStoreSubscriptions(): void;
434
443
  //#endregion
@@ -442,6 +451,12 @@ type ConferenceState = {
442
451
  p2p: boolean;
443
452
  conferenceStatus: 'initial' | 'joining' | 'joined' | 'error' | 'interrupted' | 'left' | 'restored' | 'reconnecting';
444
453
  connectionQuality: Map<string, number>;
454
+ /**
455
+ * pid → epoch ms of that participant's last remote stats update. Seeded
456
+ * when the participant joins; in peer calls, used to detect the remote
457
+ * peer's connection being lost (onRemoteConnectionLost).
458
+ */
459
+ remoteStatsTimestamps: Map<string, number>;
445
460
  raiseHandMap: Map<string, number>;
446
461
  recording: {
447
462
  status: ValueOf<typeof JitsiMeetJS.constants.recording.status>;
@@ -490,57 +505,329 @@ type ConfigStateInternal = {
490
505
  enableCompanionMode: boolean;
491
506
  sdkPlatform?: SDKPlatform;
492
507
  };
508
+ /**
509
+ * Configuration that only applies on mobile platforms
510
+ * (native iOS / Android and React Native). These options are ignored on the web.
511
+ */
493
512
  type ConfigStateMobile = {
513
+ /**
514
+ * The audio output route the call should use. One of:
515
+ * - `'SPEAKER'` — the loudspeaker.
516
+ * - `'EARPIECE'` — the phone's earpiece.
517
+ * - `'HEADPHONES'` — wired headphones.
518
+ * - `'BLUETOOTH'` — a connected Bluetooth audio device.
519
+ *
520
+ * When omitted, the SDK chooses a route automatically based on the devices
521
+ * currently connected and updates it as devices are plugged in or removed.
522
+ *
523
+ * @default undefined — chosen automatically by the SDK
524
+ */
494
525
  audioMode?: AudioMode['type'];
526
+ /**
527
+ * Hides the audio-output (route) selector button from the call controls,
528
+ * preventing the user from switching between speaker, earpiece, headphones,
529
+ * and Bluetooth from within the SDK UI.
530
+ *
531
+ * @default false
532
+ */
495
533
  hideAudioModeButton: boolean;
534
+ /**
535
+ * Allows the user to tap the picture-in-picture tile to swap who is shown in
536
+ * the main spotlight. Only applies when `layout` is `'SPOTLIGHT'`.
537
+ *
538
+ * @default true
539
+ */
540
+ enableSpotlightSwap: boolean;
496
541
  };
542
+ /**
543
+ * Configuration that only applies on the web platform.
544
+ * These options are ignored on mobile.
545
+ */
497
546
  type ConfigStateWeb = {
547
+ /**
548
+ * Applies background-noise suppression to the local microphone so that
549
+ * keyboard clicks, fans, and other ambient sounds are filtered out before
550
+ * your audio is sent to other participants.
551
+ *
552
+ * @default false
553
+ */
498
554
  enableNoiseReduction: boolean;
555
+ /**
556
+ * The `deviceId` of the microphone to capture audio from when the call
557
+ * starts. Use this to pre-select a specific input device instead of the
558
+ * system default. Device IDs come from the browser's
559
+ * `navigator.mediaDevices.enumerateDevices()`.
560
+ *
561
+ * @default undefined — uses the system default microphone
562
+ */
499
563
  audioInputDeviceId?: string;
564
+ /**
565
+ * The `deviceId` of the speaker / output device used to play remote
566
+ * participants' audio. Use this to pre-select a specific output device
567
+ * instead of the system default.
568
+ *
569
+ * @default undefined — uses the system default speaker
570
+ */
500
571
  audioOutputDeviceId?: string;
572
+ /**
573
+ * The `deviceId` of the camera to capture video from when the call starts.
574
+ * Use this to pre-select a specific camera instead of the system default.
575
+ *
576
+ * @default undefined — uses the system default camera
577
+ */
501
578
  videoInputDeviceId?: string;
579
+ /**
580
+ * Hides the screen-sharing button from the call controls, preventing the
581
+ * user from starting a screen share from within the SDK UI.
582
+ *
583
+ * @default false
584
+ */
502
585
  hideScreenSharingButton: boolean;
503
- hideVirtualBackgroundButton: boolean;
504
586
  /**
505
- * @unstable This API may change or be removed in a future release.
506
- * When enabled, the SDK renders only remote audio elements without any
507
- * visual UI (no video tiles, controls, or overlays). This allows the
508
- * host app to provide its own custom UI while the SDK handles the
509
- * underlying call connection and audio playback.
587
+ * Hides the virtual-background button from the call controls, preventing the
588
+ * user from blurring or replacing their camera background from within the
589
+ * SDK UI.
590
+ *
591
+ * @default false
510
592
  */
511
- unstable_renderAudioOnly: boolean;
593
+ hideVirtualBackgroundButton: boolean;
512
594
  };
595
+ /**
596
+ * Configuration that applies on both web and mobile platforms.
597
+ */
513
598
  type ConfigStateBoth = {
599
+ /**
600
+ * Whether the call starts as an audio-only (`'VOICE'`) call or a video
601
+ * (`'VIDEO'`) call. In a voice call no camera is acquired and no video
602
+ * tiles are shown.
603
+ *
604
+ * @default 'VIDEO'
605
+ */
514
606
  sessionType: SessionType;
607
+ /**
608
+ * The arrangement used to display participant video tiles:
609
+ * - `'TILE'` — an equal grid of all participants.
610
+ * - `'SIDEBAR'` — one main participant with the rest in a side strip.
611
+ * - `'SPOTLIGHT'` — a single full-screen participant with the local user
612
+ * shown in a small picture-in-picture tile.
613
+ *
614
+ * @default 'TILE'
615
+ */
515
616
  layout: Layout;
617
+ /**
618
+ * Which camera to use when the call starts: `'FRONT'` (selfie) or `'REAR'`
619
+ * (back). Primarily relevant on mobile devices with multiple cameras; the
620
+ * user can still switch afterwards.
621
+ *
622
+ * @default undefined — uses the SDK's current camera (front by default)
623
+ */
516
624
  initialCameraFacing?: CameraFacing;
625
+ /**
626
+ * Automatically starts recording the session as soon as the call begins,
627
+ * without the user pressing the record button. Recording must be enabled
628
+ * for your app for this to take effect.
629
+ *
630
+ * @default false
631
+ */
517
632
  autoStartRecording: boolean;
633
+ /**
634
+ * Hides the recording button from the call controls, preventing the user
635
+ * from manually starting or stopping recording from within the SDK UI.
636
+ *
637
+ * @default true
638
+ */
518
639
  hideRecordingButton: boolean;
640
+ /**
641
+ * Hides the entire bottom control bar (mic, camera, leave, and every other
642
+ * call control). Useful when the host app provides its own controls.
643
+ *
644
+ * @default false
645
+ */
519
646
  hideControlPanel: boolean;
647
+ /**
648
+ * Hides the "leave call" button from the call controls. The host app is
649
+ * then responsible for providing its own way to leave the session.
650
+ *
651
+ * @default false
652
+ */
520
653
  hideLeaveSessionButton: boolean;
654
+ /**
655
+ * Hides the top header bar of the call UI (which shows the call title,
656
+ * session timer, and similar information).
657
+ *
658
+ * @default false
659
+ */
521
660
  hideHeaderPanel: boolean;
661
+ /**
662
+ * Hides the "raise hand" button from the call controls.
663
+ *
664
+ * @default false
665
+ */
522
666
  hideRaiseHandButton: boolean;
667
+ /**
668
+ * Hides the "share / invite" button that lets the user invite others to
669
+ * join the call.
670
+ *
671
+ * @default true
672
+ */
523
673
  hideShareInviteButton: boolean;
674
+ /**
675
+ * Hides the layout-switcher button, preventing the user from changing
676
+ * between the tile, sidebar, and spotlight layouts at runtime.
677
+ *
678
+ * @default false
679
+ */
524
680
  hideChangeLayoutButton: boolean;
681
+ /**
682
+ * Hides the microphone mute/unmute button from the call controls.
683
+ *
684
+ * @default false
685
+ */
525
686
  hideToggleAudioButton: boolean;
687
+ /**
688
+ * Hides the camera on/off button from the call controls.
689
+ *
690
+ * @default false
691
+ */
526
692
  hideToggleVideoButton: boolean;
693
+ /**
694
+ * Hides the button that opens the participant list panel.
695
+ *
696
+ * @default false
697
+ */
527
698
  hideParticipantListButton: boolean;
699
+ /**
700
+ * Hides the in-call chat button.
701
+ *
702
+ * @default true
703
+ */
528
704
  hideChatButton: boolean;
705
+ /**
706
+ * Hides the elapsed-time timer that shows how long the call has been
707
+ * running.
708
+ *
709
+ * @default false
710
+ */
529
711
  hideSessionTimer: boolean;
712
+ /**
713
+ * Hides the network-quality indicator that reflects each participant's
714
+ * connection strength.
715
+ *
716
+ * @default true
717
+ */
530
718
  hideNetworkIndicator: boolean;
719
+ /**
720
+ * Hides the "recording in progress" badge shown while the session is being
721
+ * recorded. The recording itself is unaffected.
722
+ *
723
+ * @default false
724
+ */
531
725
  hideRecordingStatusIndicator: boolean;
726
+ /**
727
+ * Hides the button that switches between the front and rear cameras.
728
+ * Mainly relevant on mobile devices with more than one camera.
729
+ *
730
+ * @default false
731
+ */
532
732
  hideSwitchCameraButton: boolean;
733
+ /**
734
+ * Enables the per-participant context menu — opened by right-clicking (web)
735
+ * or long-pressing (mobile) a participant's tile — that exposes actions such
736
+ * as pinning a participant.
737
+ *
738
+ * Note: this menu is automatically unavailable in the `'SPOTLIGHT'` and
739
+ * picture-in-picture layouts regardless of this setting.
740
+ *
741
+ * @default true
742
+ */
533
743
  enableParticipantContextMenu: boolean;
744
+ /**
745
+ * The display name to show for the local user in the call (participant
746
+ * tiles, participant list, etc.). When left empty, the name associated with
747
+ * the logged-in user is used.
748
+ *
749
+ * @default '' — falls back to the logged-in user's name
750
+ */
534
751
  displayName: string;
752
+ /**
753
+ * Joins the call with the microphone muted. The user can unmute manually
754
+ * afterwards (unless the toggle-audio button is hidden).
755
+ *
756
+ * @default false
757
+ */
535
758
  startAudioMuted: boolean;
759
+ /**
760
+ * Joins the call with the camera off. The user can turn the camera on
761
+ * manually afterwards (unless the toggle-video button is hidden).
762
+ *
763
+ * @default false
764
+ */
536
765
  startVideoPaused: boolean;
766
+ /**
767
+ * Title text shown in the call's header panel (for example, the meeting or
768
+ * room name).
769
+ *
770
+ * @default '' — no title shown
771
+ */
537
772
  title: string;
773
+ /**
774
+ * How long, in milliseconds, the local user may remain alone in the call
775
+ * (no other participants) before an "are you still there?" idle prompt is
776
+ * shown. The countdown only runs while you are the only participant.
777
+ *
778
+ * @default 60000 — 60 seconds
779
+ */
538
780
  idleTimeoutPeriodBeforePrompt: number;
781
+ /**
782
+ * How long, in milliseconds, the idle prompt stays on screen waiting for a
783
+ * response before the SDK automatically leaves the call on the user's behalf.
784
+ *
785
+ * @default 180000 — 3 minutes
786
+ */
539
787
  idleTimeoutPeriodAfterPrompt: number;
788
+ /**
789
+ * Allows the user to drag the local picture-in-picture tile to reposition
790
+ * it. Only applies when `layout` is `'SPOTLIGHT'`.
791
+ *
792
+ * @default true
793
+ */
540
794
  enableSpotlightDrag: boolean;
541
- enableSpotlightSwap: boolean;
795
+ /**
796
+ * Marks this as a one-to-one (peer) call. In a peer call, when one
797
+ * participant leaves the session ends for everyone rather than continuing
798
+ * without them (unless `forceLeave` is passed when leaving). The remote
799
+ * peer's connectivity is also watched: if no remote stats arrive for 10
800
+ * seconds onRemoteConnectionLost is published, and
801
+ * onRemoteConnectionRestored once they resume.
802
+ *
803
+ * @default false
804
+ */
542
805
  isPeerCall: boolean;
806
+ /**
807
+ * Enables the in-call toast notifications surfaced by the SDK (for example
808
+ * "X joined the call" or error messages). Set to `false` to suppress all
809
+ * SDK toasts.
810
+ *
811
+ * @default true
812
+ */
543
813
  enableNotifications: boolean;
814
+ /**
815
+ * @unstable This API may change or be removed in a future release.
816
+ * When enabled in a voice call (`sessionType: 'VOICE'`), the SDK renders
817
+ * no visible UI at all — no controls, header, modals, or toast
818
+ * notifications — while the call connection, media, and events continue
819
+ * to work normally. Remote participants' audio keeps playing. The host
820
+ * app is responsible for providing its own UI, including reacting to
821
+ * session end (the SDK's "session has ended" view and the idle-timeout
822
+ * prompt/auto-leave are not shown in this mode).
823
+ *
824
+ * Only supported in voice calls: for video calls (`sessionType:
825
+ * 'VIDEO'`) the flag is ignored with a console warning and the default
826
+ * UI is rendered.
827
+ *
828
+ * @default false
829
+ */
830
+ unstable_headlessMode: boolean;
544
831
  };
545
832
  type ConfigState = ConfigStateInternal & ConfigStateMobile & ConfigStateWeb & ConfigStateBoth;
546
833
  type Actions$3 = {
@@ -668,6 +955,7 @@ declare const InternalSettingSchema: v.ObjectSchema<{
668
955
  readonly minHeightForQualityLvl: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
669
956
  readonly mobileCodecPreferenceOrder: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
670
957
  }, undefined>, undefined>;
958
+ readonly pcStatsInterval: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
671
959
  }, undefined>;
672
960
  }, undefined>;
673
961
  readonly sessionId: v.StringSchema<undefined>;
@@ -1098,6 +1386,13 @@ type SDKEvents = Omit<_SDKEvents, 'onParticipantListChanged' | 'onConnectionFail
1098
1386
  };
1099
1387
  type MobileSDKEvents = SDKEvents & {
1100
1388
  onAudioModeChanged: (payload: AudioMode['type']) => void;
1389
+ /**
1390
+ * Fired when the list of available audio modes changes,
1391
+ * e.g. a Bluetooth device or headphones are connected/disconnected.
1392
+ *
1393
+ * @param payload - The updated list of available audio modes.
1394
+ */
1395
+ onAudioModesChanged: (payload: AudioMode[]) => void;
1101
1396
  onCameraFacingChanged: (payload: CameraFacing) => void;
1102
1397
  onSwitchCameraButtonClicked: () => void;
1103
1398
  onPictureInPictureLayoutEnabled: () => void;
@@ -4178,9 +4473,19 @@ declare class CometChatCalls extends SessionMethodsCore {
4178
4473
  }): () => void;
4179
4474
  /**
4180
4475
  * Sets the audio output mode (mobile only).
4476
+ *
4477
+ * The returned promise rejects with a `{ errorCode, errorDescription }`
4478
+ * object when the mode is 'EARPIECE' during a video call
4479
+ * (ERROR_INVALID_AUDIO_MODE), when the mode is not currently available —
4480
+ * including when no call is active (ERROR_AUDIO_MODE_UNAVAILABLE), or when
4481
+ * the native route switch fails.
4482
+ *
4483
+ * The `onAudioModeChanged` event fires only after the audio route actually
4484
+ * changes, not when this method is called.
4181
4485
  * @param mode - The audio mode to set (e.g., 'SPEAKER', 'EARPIECE', 'BLUETOOTH', 'HEADPHONES').
4486
+ * @returns A Promise that resolves once the route change has been dispatched.
4182
4487
  */
4183
- static setAudioMode(mode: AudioMode['type']): void;
4488
+ static setAudioMode(mode: AudioMode['type']): Promise<void>;
4184
4489
  /**
4185
4490
  * Enables Picture-in-Picture (PIP) layout during the call.
4186
4491
  */