livevoice-sdk-react-native 2.0.1 → 3.0.0

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.
Files changed (207) hide show
  1. package/README.md +105 -66
  2. package/android/build.gradle +5 -4
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +122 -188
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +2 -2
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +187 -158
  7. package/ios/__SDK.h +1 -1
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +58 -39
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +355 -44
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +5 -6
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceSpinner.js +81 -0
  16. package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
  17. package/lib/module/components/LiveVoiceView.js +311 -133
  18. package/lib/module/components/LiveVoiceView.js.map +1 -1
  19. package/lib/module/components/PasswordPrompt.js +165 -0
  20. package/lib/module/components/PasswordPrompt.js.map +1 -0
  21. package/lib/module/components/PlayButtonView.js +180 -244
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +31 -53
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/icons/branding-ios.png +0 -0
  26. package/lib/module/icons/camera-off-android.png +0 -0
  27. package/lib/module/icons/camera-off-android@2x.png +0 -0
  28. package/lib/module/icons/camera-off-android@3x.png +0 -0
  29. package/lib/module/icons/cpu-android.png +0 -0
  30. package/lib/module/icons/cpu-android@2x.png +0 -0
  31. package/lib/module/icons/cpu-android@3x.png +0 -0
  32. package/lib/module/icons/cpu-ios.png +0 -0
  33. package/lib/module/icons/cpu-ios@2x.png +0 -0
  34. package/lib/module/icons/cpu-ios@3x.png +0 -0
  35. package/lib/module/icons/lock-android.png +0 -0
  36. package/lib/module/icons/lock-android@2x.png +0 -0
  37. package/lib/module/icons/lock-android@3x.png +0 -0
  38. package/lib/module/icons/lock-ios.png +0 -0
  39. package/lib/module/icons/lock-ios@2x.png +0 -0
  40. package/lib/module/icons/lock-ios@3x.png +0 -0
  41. package/lib/module/icons/mic-off-android.png +0 -0
  42. package/lib/module/icons/mic-off-android@2x.png +0 -0
  43. package/lib/module/icons/mic-off-android@3x.png +0 -0
  44. package/lib/module/icons/mic-slash-ios.png +0 -0
  45. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  47. package/lib/module/icons/video-slash-ios.png +0 -0
  48. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  49. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  50. package/lib/module/index.js +11 -6
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/sdk/Bridge.js +236 -0
  53. package/lib/module/sdk/Bridge.js.map +1 -0
  54. package/lib/module/sdk/Event.js +160 -0
  55. package/lib/module/sdk/Event.js.map +1 -0
  56. package/lib/module/sdk/Lifecycle.js +331 -0
  57. package/lib/module/sdk/Lifecycle.js.map +1 -0
  58. package/lib/module/sdk/LiveVoiceSdk.js +262 -268
  59. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -1
  60. package/lib/module/sdk/LiveVoiceState.js +208 -40
  61. package/lib/module/sdk/LiveVoiceState.js.map +1 -1
  62. package/lib/module/sdk/LogEntries.js +99 -0
  63. package/lib/module/sdk/LogEntries.js.map +1 -0
  64. package/lib/module/sdk/Models.js +2 -0
  65. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  66. package/lib/module/{util/PlayingState.js → sdk/NativeSdkVersions.js} +9 -8
  67. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  68. package/lib/module/sdk/Observables.js +391 -0
  69. package/lib/module/sdk/Observables.js.map +1 -0
  70. package/lib/module/sdk/Passwords.js +298 -0
  71. package/lib/module/sdk/Passwords.js.map +1 -0
  72. package/lib/module/sdk/Playback.js +35 -0
  73. package/lib/module/sdk/Playback.js.map +1 -0
  74. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  75. package/lib/module/util/Colors.js +2 -1
  76. package/lib/module/util/Colors.js.map +1 -1
  77. package/lib/module/util/Translations.js +34 -11
  78. package/lib/module/util/Translations.js.map +1 -1
  79. package/lib/module/util/freeze.js +26 -0
  80. package/lib/module/util/freeze.js.map +1 -0
  81. package/lib/module/util/logger.js +79 -41
  82. package/lib/module/util/logger.js.map +1 -1
  83. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  84. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  85. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  86. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  87. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  88. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  89. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  90. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  91. package/lib/typescript/src/components/LiveVoiceView.d.ts +81 -21
  92. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  93. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  94. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  95. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  96. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  97. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  98. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  99. package/lib/typescript/src/index.d.ts +15 -6
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  102. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  103. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  104. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  105. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  106. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +195 -190
  108. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -1
  109. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +77 -9
  110. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -1
  111. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  112. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  114. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  116. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  118. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  120. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  122. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  123. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +34 -31
  124. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  125. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  126. package/lib/typescript/src/util/Translations.d.ts +30 -8
  127. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  128. package/lib/typescript/src/util/freeze.d.ts +6 -0
  129. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  130. package/lib/typescript/src/util/logger.d.ts +17 -7
  131. package/lib/typescript/src/util/logger.d.ts.map +1 -1
  132. package/livevoice-sdk-react-native.podspec +29 -4
  133. package/package.json +12 -9
  134. package/src/components/BrandingView.tsx +42 -55
  135. package/src/components/ChannelView.tsx +329 -38
  136. package/src/components/ErrorView.tsx +9 -12
  137. package/src/components/LiveVoiceSpinner.tsx +87 -0
  138. package/src/components/LiveVoiceView.tsx +319 -201
  139. package/src/components/PasswordPrompt.tsx +144 -0
  140. package/src/components/PlayButtonView.tsx +165 -269
  141. package/src/components/ReconnectingView.tsx +28 -81
  142. package/src/icons/branding-ios.png +0 -0
  143. package/src/icons/camera-off-android.png +0 -0
  144. package/src/icons/camera-off-android@2x.png +0 -0
  145. package/src/icons/camera-off-android@3x.png +0 -0
  146. package/src/icons/cpu-android.png +0 -0
  147. package/src/icons/cpu-android@2x.png +0 -0
  148. package/src/icons/cpu-android@3x.png +0 -0
  149. package/src/icons/cpu-ios.png +0 -0
  150. package/src/icons/cpu-ios@2x.png +0 -0
  151. package/src/icons/cpu-ios@3x.png +0 -0
  152. package/src/icons/lock-android.png +0 -0
  153. package/src/icons/lock-android@2x.png +0 -0
  154. package/src/icons/lock-android@3x.png +0 -0
  155. package/src/icons/lock-ios.png +0 -0
  156. package/src/icons/lock-ios@2x.png +0 -0
  157. package/src/icons/lock-ios@3x.png +0 -0
  158. package/src/icons/mic-off-android.png +0 -0
  159. package/src/icons/mic-off-android@2x.png +0 -0
  160. package/src/icons/mic-off-android@3x.png +0 -0
  161. package/src/icons/mic-slash-ios.png +0 -0
  162. package/src/icons/mic-slash-ios@2x.png +0 -0
  163. package/src/icons/mic-slash-ios@3x.png +0 -0
  164. package/src/icons/video-slash-ios.png +0 -0
  165. package/src/icons/video-slash-ios@2x.png +0 -0
  166. package/src/icons/video-slash-ios@3x.png +0 -0
  167. package/src/index.tsx +92 -6
  168. package/src/sdk/Bridge.ts +259 -0
  169. package/src/sdk/Event.ts +187 -0
  170. package/src/sdk/Lifecycle.ts +366 -0
  171. package/src/sdk/LiveVoiceSdk.ts +285 -309
  172. package/src/sdk/LiveVoiceState.ts +230 -60
  173. package/src/sdk/LogEntries.ts +88 -0
  174. package/src/sdk/Models.ts +129 -0
  175. package/src/{util/PlayingState.ts → sdk/NativeSdkVersions.ts} +7 -6
  176. package/src/sdk/Observables.ts +414 -0
  177. package/src/sdk/Passwords.ts +286 -0
  178. package/src/sdk/Playback.ts +30 -0
  179. package/src/specs/NativeLiveVoiceSdk.ts +42 -38
  180. package/src/util/Colors.ts +2 -1
  181. package/src/util/Translations.ts +34 -12
  182. package/src/util/freeze.ts +23 -0
  183. package/src/util/logger.ts +79 -52
  184. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  185. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  186. package/lib/module/components/index.js +0 -24
  187. package/lib/module/components/index.js.map +0 -1
  188. package/lib/module/icons/mic.png +0 -0
  189. package/lib/module/util/ForegroundServiceConfig.js +0 -38
  190. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  191. package/lib/module/util/PlayingState.js.map +0 -1
  192. package/lib/module/util/UIState.js +0 -4
  193. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  194. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  195. package/lib/typescript/src/components/index.d.ts +0 -9
  196. package/lib/typescript/src/components/index.d.ts.map +0 -1
  197. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -19
  198. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  199. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  200. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  201. package/lib/typescript/src/util/UIState.d.ts +0 -86
  202. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  203. package/src/components/AudioOutputSwitchView.tsx +0 -146
  204. package/src/components/index.tsx +0 -21
  205. package/src/icons/mic.png +0 -0
  206. package/src/util/ForegroundServiceConfig.tsx +0 -42
  207. package/src/util/UIState.ts +0 -106
@@ -11,398 +11,374 @@
11
11
  //
12
12
  //===----------------------------------------------------------------------===//
13
13
 
14
+ import { Image, Platform, type ImageSourcePropType } from 'react-native';
14
15
  import LiveVoiceSdkReactNative from '../specs/NativeLiveVoiceSdk';
15
- import { type UiState, type AvailableSubtitle, type SubtitleState } from '../util/UIState';
16
+ import { awaitRevisions, initializeBridge, isInitialized, record, runtimeId } from './Bridge';
17
+ import { nativeSdkVersions } from './NativeSdkVersions';
16
18
  import {
17
- type ForegroundServiceConfig,
18
- serviceDisabled,
19
- DEFAULT_MESSAGE_SENTINEL,
20
- } from '../util/ForegroundServiceConfig';
21
- import {
22
- describeForegroundServiceConfig,
23
- LiveVoiceLogEvent,
24
- logAudioOutputChanged,
25
- logInfo,
26
- } from '../util/logger';
27
- import {
28
- type Claims,
29
- getCurrentClaims as readCurrentClaims,
30
- getCurrentUiState as readCurrentUiState,
31
- onUiStateChanged as observeUiState,
32
- } from './LiveVoiceState';
19
+ invoke,
20
+ join,
21
+ normalizeError,
22
+ usageError,
23
+ channelId as validateChannelId,
24
+ type LiveVoiceJoinRequest,
25
+ type LiveVoiceJoinedEvent,
26
+ } from './Lifecycle';
27
+ import { type LiveVoiceAudioOutput } from './Models';
28
+ import { presetAudioOutput } from './Observables';
29
+ import { LiveVoiceLogEvent, logInfo } from '../util/logger';
30
+ import { hasPasswordStore } from './Passwords';
33
31
 
34
- // Claims stays part of the public type surface for backwards compatibility.
35
- export type { Claims } from './LiveVoiceState';
32
+ /**
33
+ * How LiveVoice shares audio with other apps while a channel plays:
34
+ * - `'exclusive'`: other audio pauses, as for a media app. The default.
35
+ * - `'duckOthers'`: other audio keeps playing, quieter.
36
+ * - `'hostManaged'`: on iOS, your app configures the audio session and output route; LiveVoice
37
+ * changes neither. On Android, LiveVoice requests no audio focus, so your app handles focus
38
+ * changes and stops playback when needed. Android output selection still applies.
39
+ *
40
+ * iOS interruptions pause LiveVoice in every mode. Android's automatic focus-loss handling
41
+ * applies only when LiveVoice owns audio focus.
42
+ */
43
+ export type LiveVoiceAudioFocus = 'exclusive' | 'duckOthers' | 'hostManaged';
36
44
 
37
45
  /**
38
- * The authorization features for the joined event. Both flags are `false` until an event is joined
39
- * and ready.
46
+ * Android only: whether a foreground service keeps playback alive while your app is in the
47
+ * background. Ignored on iOS.
40
48
  */
41
- export type Features = { customUiAllowed: boolean; hideBranding: boolean };
49
+ export type LiveVoiceForegroundServiceConfig =
50
+ | { kind: 'disabled' }
51
+ | { kind: 'enabled' };
52
+
53
+ /** Options for {@link initialize}. Every option has a default. */
54
+ export type LiveVoiceInitializeOptions = {
55
+ /**
56
+ * Android only: the foreground service that keeps playback alive in the background,
57
+ * `{ kind: 'enabled' }` by default. Ignored on iOS.
58
+ */
59
+ androidServiceConfig?: LiveVoiceForegroundServiceConfig;
60
+ /**
61
+ * iOS only: whether the playing channel appears on the Lock Screen and in Control Center,
62
+ * `true` by default. It applies only while the audio focus is `'exclusive'`. Set it to `false`
63
+ * if your app shows its own media controls. Ignored on Android, where the foreground service
64
+ * governs the media notification.
65
+ */
66
+ showsSystemMediaControls?: boolean;
67
+ /** How LiveVoice shares audio with other apps, `'exclusive'` by default; see {@link LiveVoiceAudioFocus}. */
68
+ audioFocus?: LiveVoiceAudioFocus;
69
+ };
70
+
71
+ const audioFocusValues: readonly string[] = ['exclusive', 'duckOthers', 'hostManaged'];
42
72
 
43
73
  /**
44
- * Initialize the LiveVoice SDK.
74
+ * Initializes the LiveVoice SDK. Await it before joining an event; reading values and adding
75
+ * listeners works before it.
45
76
  *
46
- * @param {ForegroundServiceConfig} [androidServiceConfig=serviceDisabled] - Pass the service config on Android.
77
+ * Calling it again with the same options (after defaults) succeeds. Changed options apply while
78
+ * no event is joined (the connection is `idle` or `failed`) and reject with `invalid_argument`
79
+ * otherwise; an option a platform ignores never counts as a change there.
80
+ *
81
+ * @param options - See {@link LiveVoiceInitializeOptions}; every option has a default.
82
+ * @throws {LiveVoiceError} `invalid_argument` for an option of the wrong type or a change while
83
+ * joined, `unsupported_sdk` when the native SDK is not the version this package was built for.
47
84
  */
48
- export function initialize(
49
- androidServiceConfig: ForegroundServiceConfig = serviceDisabled,
50
- ): void {
85
+ export async function initialize(options: LiveVoiceInitializeOptions = {}): Promise<void> {
86
+ const configuration = initializeConfiguration(options);
51
87
  logInfo(LiveVoiceLogEvent.init, {
52
- androidServiceConfig: describeForegroundServiceConfig(androidServiceConfig),
88
+ androidForegroundService: configuration.androidForegroundService,
89
+ audioFocus: configuration.audioFocus,
90
+ showsSystemMediaControls: configuration.showsSystemMediaControls,
53
91
  });
92
+ // Every key is always sent, so native compares complete configurations (bridge.md 3.2).
93
+ try {
94
+ await initializeBridge({
95
+ ...configuration,
96
+ hasPasswordStore: hasPasswordStore(),
97
+ nativeSdkVersion: Platform.OS === 'android' ? nativeSdkVersions.android : nativeSdkVersions.ios,
98
+ runtimeId,
99
+ });
100
+ } catch (error) { throw normalizeError(error); }
101
+ sendPendingArtwork();
102
+ }
54
103
 
55
- let serviceTypeAsString: string | null;
56
- switch (androidServiceConfig.type) {
57
- case 'Disabled':
58
- serviceTypeAsString = null;
59
- break;
60
- case 'Enabled':
61
- if (androidServiceConfig.message == null) {
62
- serviceTypeAsString = DEFAULT_MESSAGE_SENTINEL;
63
- } else {
64
- serviceTypeAsString = androidServiceConfig.message;
65
- }
66
- break;
104
+ /** The options with their defaults applied, or `invalid_argument` without reaching native. */
105
+ function initializeConfiguration(options: LiveVoiceInitializeOptions): {
106
+ audioFocus: LiveVoiceAudioFocus;
107
+ showsSystemMediaControls: boolean;
108
+ androidForegroundService: 'enabled' | 'disabled';
109
+ } {
110
+ const invalid = (explanation: string) => usageError('invalid_argument', 'initialize', explanation);
111
+ if (options === null || typeof options !== 'object') throw invalid('The options are an object.');
112
+ const { androidServiceConfig, showsSystemMediaControls, audioFocus } = options;
113
+ if (showsSystemMediaControls !== undefined && typeof showsSystemMediaControls !== 'boolean') {
114
+ throw invalid('showsSystemMediaControls is a boolean.');
67
115
  }
68
-
69
- // Interface cannot take default-parameter, so we need to wrap it here
70
- LiveVoiceSdkReactNative.initialize(serviceTypeAsString);
116
+ if (audioFocus !== undefined && !audioFocusValues.includes(audioFocus)) {
117
+ throw invalid("audioFocus is 'exclusive', 'duckOthers' or 'hostManaged'.");
118
+ }
119
+ if (androidServiceConfig !== undefined) {
120
+ const kind = androidServiceConfig !== null && typeof androidServiceConfig === 'object'
121
+ ? androidServiceConfig.kind
122
+ : undefined;
123
+ if (kind !== 'enabled' && kind !== 'disabled') {
124
+ throw invalid("androidServiceConfig is { kind: 'enabled' } or { kind: 'disabled' }.");
125
+ }
126
+ }
127
+ return {
128
+ audioFocus: audioFocus ?? 'exclusive',
129
+ showsSystemMediaControls: showsSystemMediaControls ?? true,
130
+ // Enabled by default, so background playback works without setup.
131
+ androidForegroundService: androidServiceConfig?.kind === 'disabled' ? 'disabled' : 'enabled',
132
+ };
71
133
  }
72
134
 
73
135
  /**
74
- * Join an event.
136
+ * Joins an event and resolves with the joined event once it is ready: authenticated, its initial
137
+ * state loaded, and commands accepted. A channel can be started right away; nothing plays yet and
138
+ * no subtitles are received.
139
+ *
140
+ * When the promise resolves, the observed values (connection, current event, linked events,
141
+ * requestable languages, available subtitles) already show the joined event, or the result of a
142
+ * newer call. If an update of those values cannot be delivered, the call still resolves, after 5
143
+ * seconds, and the problem is logged; the same holds for `leaveEvent`, the joined event's
144
+ * `leave()`, `reconnect` and `switchToLinkedEvent`. The features and the subtitle state are not
145
+ * among these values: right after the promise resolves they can still show the previous value, so
146
+ * observe them.
75
147
  *
76
- * @abstract By joining an event you can display the event's channels.
148
+ * Every call is a fresh join, also to the same code: it replaces whatever is joined or joining,
149
+ * and it never retries by itself.
77
150
  *
78
- * @param {string} joinCode - The listener code of your event. You can find it on the event page of the admin web-interface by clicking on 'Share with your audience'.
79
- * @param {string | null} password - The optional password to join the event. If a password has been set for listeners in your event, it can be found in the 'Access' tab of the event page of the admin web-interface.
80
- * @param {string} apiKey - Your API key. You can find your API key in the account page when logged in on the website.
151
+ * @param request - The join code, the API key and an optional password.
152
+ * @returns The joined event; its `leave()` leaves only this join.
153
+ * @throws {LiveVoiceError} `invalid_argument` for an empty API key, a malformed join code or a
154
+ * speaker's code; `superseded` when a newer join replaced it; `cancelled` when a leave ended it;
155
+ * `timed_out` when the event was not ready within 30 seconds, which leaves the connection
156
+ * `failed` (waiting for an earlier event's cleanup counts, entering a password does not);
157
+ * `not_initialized` before `initialize()`; otherwise why the join failed, see the joining codes
158
+ * of {@link LiveVoiceErrorCode}.
81
159
  */
82
- export function joinEvent(
83
- joinCode: string,
84
- password: string | null,
85
- apiKey: string,
86
- ): void {
87
- logInfo(LiveVoiceLogEvent.joinRequest, {
88
- hasPassword: password != null,
89
- joinCode,
90
- });
91
- return LiveVoiceSdkReactNative.joinEvent(joinCode, password, apiKey);
160
+ export function joinEvent(request: LiveVoiceJoinRequest): Promise<LiveVoiceJoinedEvent> {
161
+ return join(request);
92
162
  }
93
163
 
94
164
  /**
95
- * Leave the current event.
165
+ * Leaves whatever event is joined or joining. Call it as often as you like once `initialize()`
166
+ * has resolved.
167
+ *
168
+ * Resolves when the event's local cleanup has ended, or at once when nothing is joined and no
169
+ * cleanup is still running. The observed values then already show the result: the connection is
170
+ * `idle` unless a newer join exists, and the current event and its lists are `null`. A pending
171
+ * `joinEvent`, `switchToLinkedEvent` or `reconnect` rejects with `cancelled`. To leave only one
172
+ * join, use the `leave()` of the joined event `joinEvent` returned.
96
173
  *
97
- * @abstract You can explicitly leave an event to tear down any network connections the SDK uses when you no longer display any channels.
174
+ * @throws {LiveVoiceError} `leave_incomplete` when the cleanup has not finished within 5 seconds:
175
+ * the event is left all the same, the connection is `idle` and the cleanup continues. Another
176
+ * leave then waits for the same cleanup and can fail with `leave_incomplete` again.
177
+ * `not_initialized` before `initialize()`.
98
178
  */
99
- export function leaveEvent(): void {
179
+ export async function leaveEvent(): Promise<void> {
100
180
  logInfo(LiveVoiceLogEvent.leave);
101
- return LiveVoiceSdkReactNative.leaveEvent();
181
+ // When leaveEvent() resolves, the values already show the idle connection.
182
+ const reply = await invoke('leave');
183
+ await awaitRevisions(record(reply) ? reply.revisions : undefined);
102
184
  }
103
185
 
104
186
  /**
105
- * Reconnect when a connection error occurred.
187
+ * Reconnects the joined event with a fresh connection and resolves once that connection is ready.
106
188
  *
107
- * @abstract Call this method to try to reconnect when a connection error has occurred.
108
- */
109
- export function reconnect(): void {
110
- logInfo(LiveVoiceLogEvent.reconnectRequest);
111
- return LiveVoiceSdkReactNative.reconnect();
112
- }
113
-
114
- /**
115
- * Get the claims for the current event.
189
+ * It keeps the join. Allowed while the connection is `ready` or `reconnecting`, where it forces
190
+ * an attempt now, and after a failure with a retryable error, where it joins again with the same
191
+ * code and key and the connection shows `joining`. Playback and the subtitle choice are restored
192
+ * unless a stop or a leave came in between; ready does not promise that playback has resumed.
116
193
  *
117
- * @deprecated Use {@link getCurrentFeatures} / {@link onFeaturesChanged} to read the authorization
118
- * features, or build your UI with the `renderChannel` prop on `LiveVoiceView` (which applies the
119
- * customization gating for you). Scheduled for removal in a future major version.
120
- * @returns {Claims | null} The authorization claims, or `null` if not yet joined
121
- */
122
- export function getCurrentClaims(): Claims | null {
123
- return readCurrentClaims();
124
- }
125
-
126
- /**
127
- * Get the authorization features for the joined event.
194
+ * When the promise resolves, the observed values already show the result, or that of a newer
195
+ * call. The connection can already show `reconnecting` again if it dropped meanwhile.
128
196
  *
129
- * @abstract Reflects what the joined API key permits. Both flags are `false` until an event is
130
- * joined and ready. You should only need this for an initial value; use {@link onFeaturesChanged}
131
- * to observe changes.
132
- * @returns {Features} The current features (`customUiAllowed` / `hideBranding`).
197
+ * @throws {LiveVoiceError} `not_joined` without a join and while the first join or a switch is
198
+ * still pending, which is not disturbed; `superseded` when a newer reconnect, join or switch
199
+ * replaced it; `cancelled` when a leave ended it; `timed_out` after 30 seconds. For an
200
+ * established connection only this call fails then: the event stays joined, the connection keeps
201
+ * showing `reconnecting` and recovery continues by itself. The retry of a failed join that times
202
+ * out leaves the connection `failed`. After a failure that is not retryable, that same error
203
+ * again. See {@link LiveVoiceErrorCode}.
133
204
  */
134
- export function getCurrentFeatures(): Features {
135
- const claims = readCurrentClaims();
136
- return {
137
- customUiAllowed: claims?.customUiAllowed ?? false,
138
- hideBranding: claims?.hideBranding ?? false,
139
- };
205
+ export async function reconnect(): Promise<void> {
206
+ logInfo(LiveVoiceLogEvent.reconnectRequest);
207
+ const reply = await invoke('reconnect');
208
+ // When reconnect() resolves, the values already show its result (18 item 110).
209
+ await awaitRevisions(record(reply) ? reply.revisions : undefined);
140
210
  }
141
211
 
142
212
  /**
143
- * Get the current state of the LiveVoice SDK.
213
+ * Sets where LiveVoice plays its audio: a preference the SDK keeps and applies whenever it plays.
214
+ * It works at any time, also before {@link initialize} and before joining an event, and never
215
+ * rejects. {@link getCurrentAudioOutput} reports it.
144
216
  *
145
- * @deprecated Build your UI with the `renderChannel` prop on `LiveVoiceView` instead of reading the
146
- * raw UI state. Scheduled for removal in a future major version.
147
- * @returns {UiState} The current view state
217
+ * @param output - `'system'` for the route the system chooses, `'speaker'` for the loudspeaker.
148
218
  */
149
- export function getCurrentUiState(): UiState {
150
- return readCurrentUiState();
219
+ export async function setAudioOutput(output: LiveVoiceAudioOutput): Promise<void> {
220
+ // The public type allows nothing else; another value is ignored, as native ignores it.
221
+ if (output !== 'system' && output !== 'speaker') return;
222
+ logInfo(LiveVoiceLogEvent.audioOutputSet, { output });
223
+ // Until native reports a value, the wrapper's own one follows the preference (18 item 74).
224
+ presetAudioOutput(output);
225
+ try { LiveVoiceSdkReactNative.setAudioOutput(JSON.stringify({ output })); }
226
+ catch { /* It never rejects. */ }
151
227
  }
152
228
 
153
- /**
154
- * Get the current available subtitle configurations.
155
- *
156
- * @abstract Returns `null` until the SDK has joined an event and reached the `ready` state, so you
157
- * can tell "not loaded yet" (`null`) apart from "loaded, but none available" (`[]`). You should
158
- * only need this for an initial value; use {@link onAvailableSubtitleConfigsChanged} to observe
159
- * changes.
160
- * @returns {AvailableSubtitle[] | null} The available subtitles, or `null` if not yet loaded.
161
- */
162
- export function getCurrentSubtitleConfiguration(): AvailableSubtitle[] | null {
163
- if (readCurrentUiState().type !== 'ready') return null;
164
- return JSON.parse(
165
- LiveVoiceSdkReactNative.getCurrentAvailableSubtitleConfigs(),
166
- );
167
- }
229
+ /** The artwork set before {@link initialize}, which sends it once it succeeds; `{}` clears it. */
230
+ let pendingArtwork: { uri?: string } | undefined;
168
231
 
169
232
  /**
170
- * Get the current subtitle fragments.
233
+ * Sets the image the system's media controls show for the playing channel: the Lock Screen and
234
+ * Control Center on iOS, the media notification and the quick-settings player on Android. It is
235
+ * drawn fitted, with a margin, centred on a white square. Without one, the joined event's logo
236
+ * shows, if it has one.
171
237
  *
172
- * @deprecated Use {@link getCurrentSubtitleState}, which returns the full subtitle state (type +
173
- * channel + fragments). Scheduled for removal in a future major version.
174
- * @returns {string[]} The current subtitle fragments
175
- */
176
- export function getCurrentSubtitles(): string[] {
177
- return JSON.parse(LiveVoiceSdkReactNative.getCurrentSubtitles());
178
- }
179
-
180
- /**
181
- * Get the current subtitle state.
238
+ * It works at any time, and a change shows at once. Before `initialize()` the image is kept and
239
+ * applied once `initialize()` succeeds; a failure to load it is then only logged.
182
240
  *
183
- * @abstract Unlike {@link getCurrentSubtitles} (fragments only), this returns the full state: the
184
- * {@link SubtitleState.type} (`disabled`/`automatic`/`specific`), the channel for `specific`, and
185
- * the fragments. You should only need to call this for an initial value; use
186
- * {@link onSubtitleStateChanged} to observe changes.
187
- * @returns {SubtitleState} The current subtitle state
188
- */
189
- export function getCurrentSubtitleState(): SubtitleState {
190
- return parseSubtitleState(LiveVoiceSdkReactNative.getCurrentSubtitleState());
191
- }
192
-
193
- /**
194
- * Get the current state of the audio output.
241
+ * ```tsx
242
+ * await setNowPlayingArtwork(require('./assets/artwork.png'));
243
+ * ```
195
244
  *
196
- * @abstract You should only need to call this method to get an initial value. Use {@link onAudioOutputChanged}
197
- ` to be updated about the audio state.
198
- * @returns {boolean} `true` for the speaker and `false` for the receiver.
245
+ * @param image - A bundled image (`require(…)`) or a `{ uri }` source with a `file://` or
246
+ * `http(s)://` URL (on Android also `content://` or `android.resource://`), PNG or JPEG. `null`
247
+ * removes it, so the event's logo shows again.
248
+ * @throws {LiveVoiceError} `invalid_argument` for a source without a URI, or for an image that
249
+ * cannot be loaded or decoded; the previous image then stays.
199
250
  */
200
- export function getCurrentAudioState(): boolean {
201
- return LiveVoiceSdkReactNative.getCurrentAudioState();
251
+ export async function setNowPlayingArtwork(image: ImageSourcePropType | null): Promise<void> {
252
+ const artwork = image === null ? {} : { uri: artworkUri(image) };
253
+ logInfo(LiveVoiceLogEvent.nowPlayingArtworkSet, { artwork: image === null ? 'none' : 'image' });
254
+ if (!isInitialized()) {
255
+ pendingArtwork = artwork;
256
+ return;
257
+ }
258
+ // A newer call replaces one still waiting for initialize.
259
+ pendingArtwork = undefined;
260
+ await invoke('setNowPlayingArtwork', artwork);
202
261
  }
203
262
 
204
- /**
205
- * Set the audio output.
206
- * @param {boolean} value - Set to `true` to use the speaker, and `false` to use the receiver.
207
- */
208
- export function setLiveVoiceUseSpeaker(value: boolean): void {
209
- logInfo(LiveVoiceLogEvent.audioOutputSet, {
210
- mode: value ? 'speaker' : 'receiver',
211
- });
212
- return LiveVoiceSdkReactNative.setLiveVoiceUseSpeaker(value);
263
+ /** The URI of a single image source, or `invalid_argument` without reaching native. */
264
+ function artworkUri(image: ImageSourcePropType): string {
265
+ let uri: unknown;
266
+ try { uri = Image.resolveAssetSource(image)?.uri; }
267
+ catch { uri = undefined; }
268
+ if (typeof uri !== 'string' || uri.trim() === '') {
269
+ throw usageError('invalid_argument', 'setNowPlayingArtwork',
270
+ 'The image is null or a single image source that resolves to a URI.');
271
+ }
272
+ return uri;
213
273
  }
214
274
 
215
- /**
216
- * Start playing a channel.
217
- * @abstract You can find the channel ID for a channel in the admin web-interface at the bottom when tapping *Edit Channel*.
218
- * @deprecated Manual audio playback control should only be driven through `LiveVoiceView` channel
219
- * cells. Use the `onAudioPress` helper passed to `renderChannel` instead. Scheduled for removal in
220
- * a future major version.
221
- * @param {number} [id] - The channel ID.
222
- */
223
- export function startChannel(id: number): void {
224
- logInfo(LiveVoiceLogEvent.channelStart, { channelId: id });
225
- return LiveVoiceSdkReactNative.startChannel(id);
275
+ /** Sends the artwork set before `initialize`. Native logs a failure, which keeps the previous one. */
276
+ function sendPendingArtwork(): void {
277
+ const artwork = pendingArtwork;
278
+ if (artwork === undefined) return;
279
+ pendingArtwork = undefined;
280
+ invoke('setNowPlayingArtwork', artwork).catch(() => { /* Nobody awaits it any more. */ });
226
281
  }
227
282
 
228
283
  /**
229
- * Stop playing the currently playing channel.
284
+ * Stops the playing channel and resolves once local playback has stopped.
285
+ *
286
+ * Allowed whenever an event is joined, joining, reconnecting or failed; while joining or failed
287
+ * it resolves once an earlier event's audio is released. A pending start rejects with
288
+ * `cancelled`, and a later reconnect restores nothing. The channel's `playingState` shows
289
+ * `stopped` shortly after the promise resolves.
230
290
  *
231
- * @deprecated Manual audio playback control should only be driven through `LiveVoiceView` channel
232
- * cells. Use the `onAudioPress` helper passed to `renderChannel` instead. Scheduled for removal in
233
- * a future major version.
291
+ * @throws {LiveVoiceError} `not_joined` when no event is joined; `timed_out` when playback has
292
+ * not stopped within 10 seconds while connected; `leave_incomplete` when, while joining or
293
+ * failed, that audio is not released within 5 seconds (in both cases the stop itself continues);
294
+ * `generic` with `detail.reason` `stop_failed`. It can also fail with `cancelled`. See
295
+ * {@link LiveVoiceErrorCode}.
234
296
  */
235
- export function stopChannel(): void {
297
+ export async function stopChannel(): Promise<void> {
236
298
  logInfo(LiveVoiceLogEvent.channelStop);
237
- return LiveVoiceSdkReactNative.stopChannel();
299
+ await invoke('stopChannel');
238
300
  }
239
301
 
240
302
  /**
241
- * Start receiving subtitles.
242
- * @abstract The SDK can receive a single stream of subtitle fragments at a time.
243
- * You can stop receiving subtitles using {@link stopSubtitles()}.
244
- * Whenever you call this method, any previous subtitle streams are stopped automatically and you receive the subtitles for the requested channel and language instead.
303
+ * Starts receiving subtitles. The SDK receives one subtitle stream at a time: a new start
304
+ * replaces the previous selection. It never starts or stops playback.
305
+ * {@link getCurrentAvailableSubtitles} lists what can be started; the subtitles of an offline
306
+ * channel can be started too.
245
307
  *
246
- * Note: You have to make sure that subtitles for the given channel and language are enabled in the web-interface. You can use the {@link onAvailableSubtitleConfigsChanged} handler to check if subtitles are available for a given channel in a given language.
308
+ * For a given channel the promise resolves once the server accepted the subscription. Without a
309
+ * channel the subtitles follow the playing channel. That mode is on from the call and stays on
310
+ * when a channel's subtitles are refused, also when this call rejects for the channel playing
311
+ * now. While nothing plays the promise resolves at once; otherwise once the server accepted the
312
+ * playing channel's subscription. {@link getCurrentSubtitles} shows the selection shortly after
313
+ * the promise resolves.
247
314
  *
248
- * @param {number | null} channelId - The channel to receive subtitles for. Set to `null` to always receive subtitles for the currently playing channel.
315
+ * @param options - `channelId`: the channel to receive subtitles for; leave it out or pass `null`
316
+ * to follow the playing channel. `password`: the channel's password, if it is protected; a
317
+ * password you pass is final. Without one, a given channel's password comes from the SDK's
318
+ * memory, the password store, then the password provider or the built-in prompt. Subtitles that
319
+ * follow the playing channel never ask for a password: they use the one you pass, for the channel
320
+ * playing now, or one the SDK remembers, such as the one playback was started with.
321
+ * @throws {LiveVoiceError} `invalid_argument` for a channel id that is not a positive integer;
322
+ * `not_joined` unless the connection is `ready`; `command_in_progress` when the same start is
323
+ * still pending; `cancelled` when a different start, `stopSubtitles`, a leave or a new join ended
324
+ * it; `timed_out` when the server does not accept within 10 seconds (entering a password does not
325
+ * count); `leave_incomplete` when an unfinished subtitle stop holds it up for more than 5
326
+ * seconds; a channel error such as `channel_wrong_password`. A connection loss during the call
327
+ * can fail it with `cancelled` or `network_failed`; observe the connection to follow recovery,
328
+ * the rejection and the connection update need not arrive in a particular order. See
329
+ * {@link LiveVoiceErrorCode}.
249
330
  */
250
- export function startSubtitles(channelId: number | null): void {
331
+ export async function startSubtitles(
332
+ options: { channelId?: number | null; password?: string | null } = {},
333
+ ): Promise<void> {
334
+ if (options === null || typeof options !== 'object' ||
335
+ (options.password != null && typeof options.password !== 'string')) {
336
+ throw usageError('invalid_argument', 'startSubtitles',
337
+ 'The options are an object with an optional channel id and a password that is a string or null.');
338
+ }
339
+ const channelId = options.channelId ?? null;
251
340
  logInfo(LiveVoiceLogEvent.subtitlesStart, {
252
341
  channelId: channelId == null ? 'current' : channelId,
253
342
  });
254
- const nativeSafeId = channelId == null ? -1 : channelId;
255
- LiveVoiceSdkReactNative.startSubtitles(nativeSafeId);
256
- }
257
-
258
- /**
259
- * Stop receiving subtitles.
260
- */
261
- export function stopSubtitles(): void {
262
- logInfo(LiveVoiceLogEvent.subtitlesStop);
263
- return LiveVoiceSdkReactNative.stopSubtitles();
264
- }
265
-
266
- // Event handlers
267
-
268
- /**
269
- * Handle changes of the audio output.
270
- *
271
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
272
- */
273
- export function onAudioOutputChanged(handler: (useSpeaker: boolean) => void): {
274
- remove: () => void;
275
- } {
276
- return LiveVoiceSdkReactNative.onAudioOutputChanged((data: boolean) => {
277
- logAudioOutputChanged(data);
278
- handler(data);
343
+ await invoke('startSubtitles', {
344
+ channelId: channelId == null ? null : validateChannelId(channelId, 'startSubtitles'),
345
+ // `null` is the same as no password: the lookup provides it.
346
+ password: options.password ?? undefined,
279
347
  });
280
348
  }
281
349
 
282
350
  /**
283
- * Handle changes of the UI state.
284
- *
285
- * @deprecated Build your UI with the `renderChannel` prop on `LiveVoiceView` instead of observing
286
- * the raw UI state. Scheduled for removal in a future major version.
287
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
288
- */
289
- export function onUiStateChanged(handler: (arg: UiState) => void): {
290
- remove: () => void;
291
- } {
292
- return observeUiState(handler);
293
- }
294
-
295
- /**
296
- * Handle changes of the authorization features.
351
+ * Stops receiving subtitles and resolves once their local delivery has ended.
297
352
  *
298
- * @abstract Re-emits whenever the joined session changes (join/leave/ready), so the
299
- * `customUiAllowed` / `hideBranding` flags stay in sync with the current API key. Both are `false`
300
- * while not joined.
301
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
302
- */
303
- export function onFeaturesChanged(handler: (features: Features) => void): {
304
- remove: () => void;
305
- } {
306
- return observeUiState(() => handler(getCurrentFeatures()));
307
- }
308
-
309
- /**
310
- * Handle changes of the available subtitle configurations.
353
+ * It does not wait for the server and has no time limit. Allowed whenever an event is joined,
354
+ * joining, reconnecting or failed. A subtitle start that is still pending rejects with
355
+ * `cancelled`; playback is not affected. {@link getCurrentSubtitles} shows `disabled` shortly
356
+ * after the promise resolves at the latest.
311
357
  *
312
- * @abstract Reports `null` until the SDK reaches the `ready` state (see
313
- * {@link getCurrentSubtitleConfiguration}), then the loaded array (`[]` when none are available).
314
- * Re-emits when the configs change while ready, and when the ready state itself changes.
315
- * @returns { object } - An object with a`remove` method to unsubscribe from the event.
358
+ * @throws {LiveVoiceError} `not_joined` when no event is joined. It can also fail with
359
+ * `cancelled`. See {@link LiveVoiceErrorCode}.
316
360
  */
317
- export function onAvailableSubtitleConfigsChanged(
318
- handler: (arg: AvailableSubtitle[] | null) => void,
319
- ): { remove: () => void } {
320
- const isReady = () => readCurrentUiState().type === 'ready';
321
-
322
- // Configs changed: emit them only once the SDK is ready, otherwise `null`.
323
- const configsSubscription =
324
- LiveVoiceSdkReactNative.onAvailableSubtitleConfigsChanged((data: string) => {
325
- handler(isReady() ? (JSON.parse(data) as AvailableSubtitle[]) : null);
326
- });
327
- // Readiness changed: re-emit the current configs (or `null` if no longer ready).
328
- const uiStateSubscription = observeUiState(() => {
329
- handler(getCurrentSubtitleConfiguration());
330
- });
331
-
332
- return {
333
- remove: () => {
334
- configsSubscription.remove();
335
- uiStateSubscription.remove();
336
- },
337
- };
338
- }
339
-
340
- /**
341
- * Handle changes of the subtitle fragments.
342
- *
343
- * @deprecated Use {@link onSubtitleStateChanged}, which reports the full subtitle state (type +
344
- * channel + fragments). Scheduled for removal in a future major version.
345
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
346
- */
347
- export function onSubtitlesChanged(handler: (arg: string[]) => void): {
348
- remove: () => void;
349
- } {
350
- return LiveVoiceSdkReactNative.onSubtitlesChanged((data: string) => {
351
- const subtitles: string[] = JSON.parse(data);
352
- handler(subtitles);
353
- });
354
- }
355
-
356
- /**
357
- * Handle changes of the subtitle state.
358
- *
359
- * @abstract Reports the full state (type + channel + fragments), unlike the fragments-only
360
- * {@link onSubtitlesChanged}.
361
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
362
- */
363
- export function onSubtitleStateChanged(
364
- handler: (state: SubtitleState) => void,
365
- ): { remove: () => void } {
366
- return LiveVoiceSdkReactNative.onSubtitleStateChanged((data: string) => {
367
- handler(parseSubtitleState(data));
368
- });
361
+ export async function stopSubtitles(): Promise<void> {
362
+ logInfo(LiveVoiceLogEvent.subtitlesStop);
363
+ await invoke('stopSubtitles');
369
364
  }
370
365
 
371
366
  /**
372
- * Open the LiveVoice website in the device's default browser.
367
+ * Opens the LiveVoice website in the device's default browser.
373
368
  */
374
369
  export function openLiveVoiceWebsite(): void {
375
370
  logInfo(LiveVoiceLogEvent.openWebsite);
376
371
  return LiveVoiceSdkReactNative.openLiveVoiceWebsite();
377
372
  }
378
373
 
379
- /**
380
- * Get the version of the LiveVoice React Native SDK.
381
- *
382
- * @returns {string} The SDK version, e.g. `"2.0.1"`.
383
- */
374
+ /** Returns the version of this React Native package, for example `"3.0.0"`. */
384
375
  export function getSdkVersion(): string {
385
376
  return LiveVoiceSdkReactNative.getSdkVersion();
386
377
  }
387
378
 
388
- type SubtitleStateWire = {
389
- type: 'disabled' | 'automatic' | 'specific';
390
- channelId?: number;
391
- fragments?: string[];
392
- };
393
-
394
- function parseSubtitleState(data: string): SubtitleState {
395
- const wire = JSON.parse(data) as SubtitleStateWire;
396
- switch (wire.type) {
397
- case 'automatic':
398
- return { type: 'automatic', fragments: wire.fragments ?? [] };
399
- case 'specific':
400
- return {
401
- type: 'specific',
402
- channelId: wire.channelId ?? -1,
403
- fragments: wire.fragments ?? [],
404
- };
405
- default:
406
- return { type: 'disabled' };
407
- }
379
+ /**
380
+ * Returns the version of the native LiveVoice SDK this package uses, for example `"3.0.0"`.
381
+ */
382
+ export function getNativeSdkVersion(): string {
383
+ return LiveVoiceSdkReactNative.getNativeSdkVersion();
408
384
  }