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
@@ -1,210 +1,215 @@
1
- import { type UiState, type AvailableSubtitle, type SubtitleState } from '../util/UIState';
2
- import { type ForegroundServiceConfig } from '../util/ForegroundServiceConfig';
3
- import { type Claims } from './LiveVoiceState';
4
- export type { Claims } from './LiveVoiceState';
1
+ import { type ImageSourcePropType } from 'react-native';
2
+ import { type LiveVoiceJoinRequest, type LiveVoiceJoinedEvent } from './Lifecycle';
3
+ import { type LiveVoiceAudioOutput } from './Models';
5
4
  /**
6
- * The authorization features for the joined event. Both flags are `false` until an event is joined
7
- * and ready.
8
- */
9
- export type Features = {
10
- customUiAllowed: boolean;
11
- hideBranding: boolean;
12
- };
13
- /**
14
- * Initialize the LiveVoice SDK.
5
+ * How LiveVoice shares audio with other apps while a channel plays:
6
+ * - `'exclusive'`: other audio pauses, as for a media app. The default.
7
+ * - `'duckOthers'`: other audio keeps playing, quieter.
8
+ * - `'hostManaged'`: on iOS, your app configures the audio session and output route; LiveVoice
9
+ * changes neither. On Android, LiveVoice requests no audio focus, so your app handles focus
10
+ * changes and stops playback when needed. Android output selection still applies.
15
11
  *
16
- * @param {ForegroundServiceConfig} [androidServiceConfig=serviceDisabled] - Pass the service config on Android.
12
+ * iOS interruptions pause LiveVoice in every mode. Android's automatic focus-loss handling
13
+ * applies only when LiveVoice owns audio focus.
17
14
  */
18
- export declare function initialize(androidServiceConfig?: ForegroundServiceConfig): void;
15
+ export type LiveVoiceAudioFocus = 'exclusive' | 'duckOthers' | 'hostManaged';
19
16
  /**
20
- * Join an event.
21
- *
22
- * @abstract By joining an event you can display the event's channels.
23
- *
24
- * @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'.
25
- * @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.
26
- * @param {string} apiKey - Your API key. You can find your API key in the account page when logged in on the website.
27
- */
28
- export declare function joinEvent(joinCode: string, password: string | null, apiKey: string): void;
29
- /**
30
- * Leave the current event.
31
- *
32
- * @abstract You can explicitly leave an event to tear down any network connections the SDK uses when you no longer display any channels.
33
- */
34
- export declare function leaveEvent(): void;
35
- /**
36
- * Reconnect when a connection error occurred.
37
- *
38
- * @abstract Call this method to try to reconnect when a connection error has occurred.
39
- */
40
- export declare function reconnect(): void;
41
- /**
42
- * Get the claims for the current event.
43
- *
44
- * @deprecated Use {@link getCurrentFeatures} / {@link onFeaturesChanged} to read the authorization
45
- * features, or build your UI with the `renderChannel` prop on `LiveVoiceView` (which applies the
46
- * customization gating for you). Scheduled for removal in a future major version.
47
- * @returns {Claims | null} The authorization claims, or `null` if not yet joined
48
- */
49
- export declare function getCurrentClaims(): Claims | null;
50
- /**
51
- * Get the authorization features for the joined event.
52
- *
53
- * @abstract Reflects what the joined API key permits. Both flags are `false` until an event is
54
- * joined and ready. You should only need this for an initial value; use {@link onFeaturesChanged}
55
- * to observe changes.
56
- * @returns {Features} The current features (`customUiAllowed` / `hideBranding`).
17
+ * Android only: whether a foreground service keeps playback alive while your app is in the
18
+ * background. Ignored on iOS.
57
19
  */
58
- export declare function getCurrentFeatures(): Features;
59
- /**
60
- * Get the current state of the LiveVoice SDK.
61
- *
62
- * @deprecated Build your UI with the `renderChannel` prop on `LiveVoiceView` instead of reading the
63
- * raw UI state. Scheduled for removal in a future major version.
64
- * @returns {UiState} The current view state
65
- */
66
- export declare function getCurrentUiState(): UiState;
67
- /**
68
- * Get the current available subtitle configurations.
69
- *
70
- * @abstract Returns `null` until the SDK has joined an event and reached the `ready` state, so you
71
- * can tell "not loaded yet" (`null`) apart from "loaded, but none available" (`[]`). You should
72
- * only need this for an initial value; use {@link onAvailableSubtitleConfigsChanged} to observe
73
- * changes.
74
- * @returns {AvailableSubtitle[] | null} The available subtitles, or `null` if not yet loaded.
75
- */
76
- export declare function getCurrentSubtitleConfiguration(): AvailableSubtitle[] | null;
77
- /**
78
- * Get the current subtitle fragments.
79
- *
80
- * @deprecated Use {@link getCurrentSubtitleState}, which returns the full subtitle state (type +
81
- * channel + fragments). Scheduled for removal in a future major version.
82
- * @returns {string[]} The current subtitle fragments
83
- */
84
- export declare function getCurrentSubtitles(): string[];
85
- /**
86
- * Get the current subtitle state.
87
- *
88
- * @abstract Unlike {@link getCurrentSubtitles} (fragments only), this returns the full state: the
89
- * {@link SubtitleState.type} (`disabled`/`automatic`/`specific`), the channel for `specific`, and
90
- * the fragments. You should only need to call this for an initial value; use
91
- * {@link onSubtitleStateChanged} to observe changes.
92
- * @returns {SubtitleState} The current subtitle state
93
- */
94
- export declare function getCurrentSubtitleState(): SubtitleState;
95
- /**
96
- * Get the current state of the audio output.
97
- *
98
- * @abstract You should only need to call this method to get an initial value. Use {@link onAudioOutputChanged}
99
- ` to be updated about the audio state.
100
- * @returns {boolean} `true` for the speaker and `false` for the receiver.
101
- */
102
- export declare function getCurrentAudioState(): boolean;
103
- /**
104
- * Set the audio output.
105
- * @param {boolean} value - Set to `true` to use the speaker, and `false` to use the receiver.
106
- */
107
- export declare function setLiveVoiceUseSpeaker(value: boolean): void;
108
- /**
109
- * Start playing a channel.
110
- * @abstract You can find the channel ID for a channel in the admin web-interface at the bottom when tapping *Edit Channel*.
111
- * @deprecated Manual audio playback control should only be driven through `LiveVoiceView` channel
112
- * cells. Use the `onAudioPress` helper passed to `renderChannel` instead. Scheduled for removal in
113
- * a future major version.
114
- * @param {number} [id] - The channel ID.
115
- */
116
- export declare function startChannel(id: number): void;
117
- /**
118
- * Stop playing the currently playing channel.
119
- *
120
- * @deprecated Manual audio playback control should only be driven through `LiveVoiceView` channel
121
- * cells. Use the `onAudioPress` helper passed to `renderChannel` instead. Scheduled for removal in
122
- * a future major version.
123
- */
124
- export declare function stopChannel(): void;
125
- /**
126
- * Start receiving subtitles.
127
- * @abstract The SDK can receive a single stream of subtitle fragments at a time.
128
- * You can stop receiving subtitles using {@link stopSubtitles()}.
129
- * Whenever you call this method, any previous subtitle streams are stopped automatically and you receive the subtitles for the requested channel and language instead.
130
- *
131
- * 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.
132
- *
133
- * @param {number | null} channelId - The channel to receive subtitles for. Set to `null` to always receive subtitles for the currently playing channel.
134
- */
135
- export declare function startSubtitles(channelId: number | null): void;
136
- /**
137
- * Stop receiving subtitles.
138
- */
139
- export declare function stopSubtitles(): void;
140
- /**
141
- * Handle changes of the audio output.
142
- *
143
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
144
- */
145
- export declare function onAudioOutputChanged(handler: (useSpeaker: boolean) => void): {
146
- remove: () => void;
20
+ export type LiveVoiceForegroundServiceConfig = {
21
+ kind: 'disabled';
22
+ } | {
23
+ kind: 'enabled';
147
24
  };
148
- /**
149
- * Handle changes of the UI state.
150
- *
151
- * @deprecated Build your UI with the `renderChannel` prop on `LiveVoiceView` instead of observing
152
- * the raw UI state. Scheduled for removal in a future major version.
153
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
154
- */
155
- export declare function onUiStateChanged(handler: (arg: UiState) => void): {
156
- remove: () => void;
25
+ /** Options for {@link initialize}. Every option has a default. */
26
+ export type LiveVoiceInitializeOptions = {
27
+ /**
28
+ * Android only: the foreground service that keeps playback alive in the background,
29
+ * `{ kind: 'enabled' }` by default. Ignored on iOS.
30
+ */
31
+ androidServiceConfig?: LiveVoiceForegroundServiceConfig;
32
+ /**
33
+ * iOS only: whether the playing channel appears on the Lock Screen and in Control Center,
34
+ * `true` by default. It applies only while the audio focus is `'exclusive'`. Set it to `false`
35
+ * if your app shows its own media controls. Ignored on Android, where the foreground service
36
+ * governs the media notification.
37
+ */
38
+ showsSystemMediaControls?: boolean;
39
+ /** How LiveVoice shares audio with other apps, `'exclusive'` by default; see {@link LiveVoiceAudioFocus}. */
40
+ audioFocus?: LiveVoiceAudioFocus;
157
41
  };
158
42
  /**
159
- * Handle changes of the authorization features.
43
+ * Initializes the LiveVoice SDK. Await it before joining an event; reading values and adding
44
+ * listeners works before it.
160
45
  *
161
- * @abstract Re-emits whenever the joined session changes (join/leave/ready), so the
162
- * `customUiAllowed` / `hideBranding` flags stay in sync with the current API key. Both are `false`
163
- * while not joined.
164
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
165
- */
166
- export declare function onFeaturesChanged(handler: (features: Features) => void): {
167
- remove: () => void;
168
- };
169
- /**
170
- * Handle changes of the available subtitle configurations.
46
+ * Calling it again with the same options (after defaults) succeeds. Changed options apply while
47
+ * no event is joined (the connection is `idle` or `failed`) and reject with `invalid_argument`
48
+ * otherwise; an option a platform ignores never counts as a change there.
171
49
  *
172
- * @abstract Reports `null` until the SDK reaches the `ready` state (see
173
- * {@link getCurrentSubtitleConfiguration}), then the loaded array (`[]` when none are available).
174
- * Re-emits when the configs change while ready, and when the ready state itself changes.
175
- * @returns { object } - An object with a`remove` method to unsubscribe from the event.
50
+ * @param options - See {@link LiveVoiceInitializeOptions}; every option has a default.
51
+ * @throws {LiveVoiceError} `invalid_argument` for an option of the wrong type or a change while
52
+ * joined, `unsupported_sdk` when the native SDK is not the version this package was built for.
176
53
  */
177
- export declare function onAvailableSubtitleConfigsChanged(handler: (arg: AvailableSubtitle[] | null) => void): {
178
- remove: () => void;
179
- };
54
+ export declare function initialize(options?: LiveVoiceInitializeOptions): Promise<void>;
180
55
  /**
181
- * Handle changes of the subtitle fragments.
56
+ * Joins an event and resolves with the joined event once it is ready: authenticated, its initial
57
+ * state loaded, and commands accepted. A channel can be started right away; nothing plays yet and
58
+ * no subtitles are received.
182
59
  *
183
- * @deprecated Use {@link onSubtitleStateChanged}, which reports the full subtitle state (type +
184
- * channel + fragments). Scheduled for removal in a future major version.
185
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
186
- */
187
- export declare function onSubtitlesChanged(handler: (arg: string[]) => void): {
188
- remove: () => void;
189
- };
190
- /**
191
- * Handle changes of the subtitle state.
60
+ * When the promise resolves, the observed values (connection, current event, linked events,
61
+ * requestable languages, available subtitles) already show the joined event, or the result of a
62
+ * newer call. If an update of those values cannot be delivered, the call still resolves, after 5
63
+ * seconds, and the problem is logged; the same holds for `leaveEvent`, the joined event's
64
+ * `leave()`, `reconnect` and `switchToLinkedEvent`. The features and the subtitle state are not
65
+ * among these values: right after the promise resolves they can still show the previous value, so
66
+ * observe them.
192
67
  *
193
- * @abstract Reports the full state (type + channel + fragments), unlike the fragments-only
194
- * {@link onSubtitlesChanged}.
195
- * @returns {object} - An object with a `remove` method to unsubscribe from the event.
196
- */
197
- export declare function onSubtitleStateChanged(handler: (state: SubtitleState) => void): {
198
- remove: () => void;
199
- };
68
+ * Every call is a fresh join, also to the same code: it replaces whatever is joined or joining,
69
+ * and it never retries by itself.
70
+ *
71
+ * @param request - The join code, the API key and an optional password.
72
+ * @returns The joined event; its `leave()` leaves only this join.
73
+ * @throws {LiveVoiceError} `invalid_argument` for an empty API key, a malformed join code or a
74
+ * speaker's code; `superseded` when a newer join replaced it; `cancelled` when a leave ended it;
75
+ * `timed_out` when the event was not ready within 30 seconds, which leaves the connection
76
+ * `failed` (waiting for an earlier event's cleanup counts, entering a password does not);
77
+ * `not_initialized` before `initialize()`; otherwise why the join failed, see the joining codes
78
+ * of {@link LiveVoiceErrorCode}.
79
+ */
80
+ export declare function joinEvent(request: LiveVoiceJoinRequest): Promise<LiveVoiceJoinedEvent>;
81
+ /**
82
+ * Leaves whatever event is joined or joining. Call it as often as you like once `initialize()`
83
+ * has resolved.
84
+ *
85
+ * Resolves when the event's local cleanup has ended, or at once when nothing is joined and no
86
+ * cleanup is still running. The observed values then already show the result: the connection is
87
+ * `idle` unless a newer join exists, and the current event and its lists are `null`. A pending
88
+ * `joinEvent`, `switchToLinkedEvent` or `reconnect` rejects with `cancelled`. To leave only one
89
+ * join, use the `leave()` of the joined event `joinEvent` returned.
90
+ *
91
+ * @throws {LiveVoiceError} `leave_incomplete` when the cleanup has not finished within 5 seconds:
92
+ * the event is left all the same, the connection is `idle` and the cleanup continues. Another
93
+ * leave then waits for the same cleanup and can fail with `leave_incomplete` again.
94
+ * `not_initialized` before `initialize()`.
95
+ */
96
+ export declare function leaveEvent(): Promise<void>;
97
+ /**
98
+ * Reconnects the joined event with a fresh connection and resolves once that connection is ready.
99
+ *
100
+ * It keeps the join. Allowed while the connection is `ready` or `reconnecting`, where it forces
101
+ * an attempt now, and after a failure with a retryable error, where it joins again with the same
102
+ * code and key and the connection shows `joining`. Playback and the subtitle choice are restored
103
+ * unless a stop or a leave came in between; ready does not promise that playback has resumed.
104
+ *
105
+ * When the promise resolves, the observed values already show the result, or that of a newer
106
+ * call. The connection can already show `reconnecting` again if it dropped meanwhile.
107
+ *
108
+ * @throws {LiveVoiceError} `not_joined` without a join and while the first join or a switch is
109
+ * still pending, which is not disturbed; `superseded` when a newer reconnect, join or switch
110
+ * replaced it; `cancelled` when a leave ended it; `timed_out` after 30 seconds. For an
111
+ * established connection only this call fails then: the event stays joined, the connection keeps
112
+ * showing `reconnecting` and recovery continues by itself. The retry of a failed join that times
113
+ * out leaves the connection `failed`. After a failure that is not retryable, that same error
114
+ * again. See {@link LiveVoiceErrorCode}.
115
+ */
116
+ export declare function reconnect(): Promise<void>;
117
+ /**
118
+ * Sets where LiveVoice plays its audio: a preference the SDK keeps and applies whenever it plays.
119
+ * It works at any time, also before {@link initialize} and before joining an event, and never
120
+ * rejects. {@link getCurrentAudioOutput} reports it.
121
+ *
122
+ * @param output - `'system'` for the route the system chooses, `'speaker'` for the loudspeaker.
123
+ */
124
+ export declare function setAudioOutput(output: LiveVoiceAudioOutput): Promise<void>;
125
+ /**
126
+ * Sets the image the system's media controls show for the playing channel: the Lock Screen and
127
+ * Control Center on iOS, the media notification and the quick-settings player on Android. It is
128
+ * drawn fitted, with a margin, centred on a white square. Without one, the joined event's logo
129
+ * shows, if it has one.
130
+ *
131
+ * It works at any time, and a change shows at once. Before `initialize()` the image is kept and
132
+ * applied once `initialize()` succeeds; a failure to load it is then only logged.
133
+ *
134
+ * ```tsx
135
+ * await setNowPlayingArtwork(require('./assets/artwork.png'));
136
+ * ```
137
+ *
138
+ * @param image - A bundled image (`require(…)`) or a `{ uri }` source with a `file://` or
139
+ * `http(s)://` URL (on Android also `content://` or `android.resource://`), PNG or JPEG. `null`
140
+ * removes it, so the event's logo shows again.
141
+ * @throws {LiveVoiceError} `invalid_argument` for a source without a URI, or for an image that
142
+ * cannot be loaded or decoded; the previous image then stays.
143
+ */
144
+ export declare function setNowPlayingArtwork(image: ImageSourcePropType | null): Promise<void>;
145
+ /**
146
+ * Stops the playing channel and resolves once local playback has stopped.
147
+ *
148
+ * Allowed whenever an event is joined, joining, reconnecting or failed; while joining or failed
149
+ * it resolves once an earlier event's audio is released. A pending start rejects with
150
+ * `cancelled`, and a later reconnect restores nothing. The channel's `playingState` shows
151
+ * `stopped` shortly after the promise resolves.
152
+ *
153
+ * @throws {LiveVoiceError} `not_joined` when no event is joined; `timed_out` when playback has
154
+ * not stopped within 10 seconds while connected; `leave_incomplete` when, while joining or
155
+ * failed, that audio is not released within 5 seconds (in both cases the stop itself continues);
156
+ * `generic` with `detail.reason` `stop_failed`. It can also fail with `cancelled`. See
157
+ * {@link LiveVoiceErrorCode}.
158
+ */
159
+ export declare function stopChannel(): Promise<void>;
160
+ /**
161
+ * Starts receiving subtitles. The SDK receives one subtitle stream at a time: a new start
162
+ * replaces the previous selection. It never starts or stops playback.
163
+ * {@link getCurrentAvailableSubtitles} lists what can be started; the subtitles of an offline
164
+ * channel can be started too.
165
+ *
166
+ * For a given channel the promise resolves once the server accepted the subscription. Without a
167
+ * channel the subtitles follow the playing channel. That mode is on from the call and stays on
168
+ * when a channel's subtitles are refused, also when this call rejects for the channel playing
169
+ * now. While nothing plays the promise resolves at once; otherwise once the server accepted the
170
+ * playing channel's subscription. {@link getCurrentSubtitles} shows the selection shortly after
171
+ * the promise resolves.
172
+ *
173
+ * @param options - `channelId`: the channel to receive subtitles for; leave it out or pass `null`
174
+ * to follow the playing channel. `password`: the channel's password, if it is protected; a
175
+ * password you pass is final. Without one, a given channel's password comes from the SDK's
176
+ * memory, the password store, then the password provider or the built-in prompt. Subtitles that
177
+ * follow the playing channel never ask for a password: they use the one you pass, for the channel
178
+ * playing now, or one the SDK remembers, such as the one playback was started with.
179
+ * @throws {LiveVoiceError} `invalid_argument` for a channel id that is not a positive integer;
180
+ * `not_joined` unless the connection is `ready`; `command_in_progress` when the same start is
181
+ * still pending; `cancelled` when a different start, `stopSubtitles`, a leave or a new join ended
182
+ * it; `timed_out` when the server does not accept within 10 seconds (entering a password does not
183
+ * count); `leave_incomplete` when an unfinished subtitle stop holds it up for more than 5
184
+ * seconds; a channel error such as `channel_wrong_password`. A connection loss during the call
185
+ * can fail it with `cancelled` or `network_failed`; observe the connection to follow recovery,
186
+ * the rejection and the connection update need not arrive in a particular order. See
187
+ * {@link LiveVoiceErrorCode}.
188
+ */
189
+ export declare function startSubtitles(options?: {
190
+ channelId?: number | null;
191
+ password?: string | null;
192
+ }): Promise<void>;
200
193
  /**
201
- * Open the LiveVoice website in the device's default browser.
194
+ * Stops receiving subtitles and resolves once their local delivery has ended.
195
+ *
196
+ * It does not wait for the server and has no time limit. Allowed whenever an event is joined,
197
+ * joining, reconnecting or failed. A subtitle start that is still pending rejects with
198
+ * `cancelled`; playback is not affected. {@link getCurrentSubtitles} shows `disabled` shortly
199
+ * after the promise resolves at the latest.
200
+ *
201
+ * @throws {LiveVoiceError} `not_joined` when no event is joined. It can also fail with
202
+ * `cancelled`. See {@link LiveVoiceErrorCode}.
203
+ */
204
+ export declare function stopSubtitles(): Promise<void>;
205
+ /**
206
+ * Opens the LiveVoice website in the device's default browser.
202
207
  */
203
208
  export declare function openLiveVoiceWebsite(): void;
209
+ /** Returns the version of this React Native package, for example `"3.0.0"`. */
210
+ export declare function getSdkVersion(): string;
204
211
  /**
205
- * Get the version of the LiveVoice React Native SDK.
206
- *
207
- * @returns {string} The SDK version, e.g. `"2.0.1"`.
212
+ * Returns the version of the native LiveVoice SDK this package uses, for example `"3.0.0"`.
208
213
  */
209
- export declare function getSdkVersion(): string;
214
+ export declare function getNativeSdkVersion(): string;
210
215
  //# sourceMappingURL=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I,OAAO,CAAC,IAAI,CAAC,CAKhD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAK/C;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhF;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAU3F;AAsBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAGjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,cAAc,CAClC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GACpE,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAGnD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
@@ -1,12 +1,80 @@
1
- import { type UiState } from '../util/UIState';
2
- /** Authorization features for the joined event. Internal: the view uses it for branding/gating. */
3
- export type Claims = {
4
- hideBranding: boolean;
5
- customUiAllowed: boolean;
6
- };
7
- export declare function getCurrentClaims(): Claims | null;
8
- export declare function getCurrentUiState(): UiState;
9
- export declare function onUiStateChanged(handler: (arg: UiState) => void): {
1
+ import { LiveVoiceError, type RetryValue } from './Lifecycle';
2
+ import { type LiveVoiceChannel, type LiveVoiceFeatures } from './Models';
3
+ /** The event's brand colours, `'#RRGGBB'`. */
4
+ export type BrandColors = {
5
+ light: string;
6
+ dark: string;
7
+ };
8
+ /** What a double tap or a named action on a default cell does (bridge.md 2.4). */
9
+ export type CellActionKind = 'toggleAudio' | 'toggleSubtitles';
10
+ /**
11
+ * A default cell's accessibility, computed natively by the native default cell's own code and in
12
+ * the native SDK's language (bridge.md 2.4). The cell renders exactly this.
13
+ */
14
+ export type CellAccessibility = {
15
+ /** The channel name. */
16
+ label: string;
17
+ /** The row's states as the native cell joins them; `''` when there are none. */
18
+ value: string;
19
+ isButton: boolean;
20
+ isSelected: boolean;
21
+ /** What a double tap does, or `null` where it does nothing. */
22
+ activation: CellActionKind | null;
23
+ /** The named actions in the native order, each with its localised name. */
24
+ actions: {
25
+ kind: CellActionKind;
26
+ name: string;
27
+ }[];
28
+ };
29
+ /** A default cell's status line under the name, as native computed it (bridge.md 2.4). */
30
+ export type CellStatus = {
31
+ /** The localised line, for example "Inactive" or "AI active". */
32
+ text: string;
33
+ /** The CPU icon precedes the text: an online AI speaker. */
34
+ showsAiIcon: boolean;
35
+ };
36
+ /** A default cell's mute mark, as native computed it (bridge.md 2.4). */
37
+ export type CellMuteMark = 'microphone' | 'camera';
38
+ /** The part the default view shows. */
39
+ export type ViewPart = {
40
+ kind: 'loading';
41
+ } | {
42
+ kind: 'ready';
43
+ channels: LiveVoiceChannel[];
44
+ /** Each channel's `LiveVoiceChannelCell.isEnabled`, by id. */
45
+ isEnabled: ReadonlyMap<number, boolean>;
46
+ /** Whether each channel's subtitles are the open ones, by id: the default cell's marker. */
47
+ subtitlesOpen: ReadonlyMap<number, boolean>;
48
+ /** Each default cell's accessibility, by id; `null` for one native did not send. */
49
+ accessibility: ReadonlyMap<number, CellAccessibility | null>;
50
+ /** Each default cell's status line, by id; `null` for none. */
51
+ status: ReadonlyMap<number, CellStatus | null>;
52
+ /** Each default cell's mute mark, by id; `null` for none. */
53
+ muteMark: ReadonlyMap<number, CellMuteMark | null>;
54
+ /** The list stays, drawn disabled, while the connection briefly recovers. */
55
+ inReconnectGrace: boolean;
56
+ brandColors: BrandColors | null;
57
+ } | {
58
+ kind: 'reconnecting';
59
+ retry: RetryValue;
60
+ } | {
61
+ kind: 'error';
62
+ error: LiveVoiceError;
63
+ };
64
+ /**
65
+ * The default view's model: the part to show, and the permission of the join it belongs to,
66
+ * `null` until that join has authenticated. The gate and the branding read this permission, so
67
+ * channels and permission always come from the same join.
68
+ */
69
+ export type ViewModel = {
70
+ part: ViewPart;
71
+ features: LiveVoiceFeatures | null;
72
+ };
73
+ export declare function getCurrentViewModel(): ViewModel;
74
+ /** Calls `handler` whenever the default view changes. */
75
+ export declare function onViewModelChanged(handler: (model: ViewModel) => void): {
10
76
  remove: () => void;
11
77
  };
78
+ /** A wire channel (bridge.md 2.2) as the public `LiveVoiceChannel`. */
79
+ export declare function decodeChannel(wire: Record<string, unknown>): LiveVoiceChannel;
12
80
  //# sourceMappingURL=LiveVoiceState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LiveVoiceState.d.ts","sourceRoot":"","sources":["../../../../src/sdk/LiveVoiceState.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,iBAAiB,CAAC;AAG7D,mGAAmG;AACnG,MAAM,MAAM,MAAM,GAAG;IAAE,YAAY,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC;AAoBzE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAIhD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAAG;IACjE,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAMA"}
1
+ {"version":3,"file":"LiveVoiceState.d.ts","sourceRoot":"","sources":["../../../../src/sdk/LiveVoiceState.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA4B,cAAc,EAAE,KAAK,UAA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,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC7D,+DAA+D;IAC/D,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;IAC/C,6DAA6D;IAC7D,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC,CAAC;IACnD,6EAA6E;IAC7E,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC,GACD;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,CAAC;AAmB/E,wBAAgB,mBAAmB,IAAI,SAAS,CAE/C;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAO9F;AA8FD,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CA+B7E"}
@@ -0,0 +1,28 @@
1
+ import { type LiveVoiceSubscription } from './Models';
2
+ /** `error` for a failed result and a failed connection, `info` for everything else. */
3
+ export type LiveVoiceLogLevel = 'info' | 'error';
4
+ /** One diagnostic event of the LiveVoice SDK. */
5
+ export type LiveVoiceLogEntry = {
6
+ /** The event's name, `LV_…`. */
7
+ event: string;
8
+ level: LiveVoiceLogLevel;
9
+ /** The event's details. A field without a value is left out. */
10
+ fields: Record<string, string>;
11
+ /** When it happened. */
12
+ timestamp: Date;
13
+ };
14
+ /** Receives one log entry; see {@link addLogListener}. */
15
+ export type LiveVoiceLogListener = (entry: LiveVoiceLogEntry) => void;
16
+ /**
17
+ * Receives the SDK's diagnostic events, the ones it also writes to the system log. Entries are
18
+ * not replayed: a listener gets what is logged after it was added, in order. It can be added
19
+ * before `initialize()` and stays until it is removed.
20
+ *
21
+ * Entries never hold the API key or a password. Return quickly and do not call the SDK from the
22
+ * listener; an error it throws is caught.
23
+ *
24
+ * @param listener - Called with each entry.
25
+ * @returns A subscription; its `remove()` stops the entries.
26
+ */
27
+ export declare function addLogListener(listener: LiveVoiceLogListener): LiveVoiceSubscription;
28
+ //# sourceMappingURL=LogEntries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogEntries.d.ts","sourceRoot":"","sources":["../../../../src/sdk/LogEntries.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,uFAAuF;AACvF,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjD,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,iBAAiB,CAAC;IACzB,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,wBAAwB;IACxB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAuBtE;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,GAAG,qBAAqB,CAqBpF"}