livevoice-sdk-react-native 2.0.0 → 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.
- package/README.md +158 -7
- package/android/build.gradle +18 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
- package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
- package/ios/LiveVoiceRNBridge.swift +362 -0
- package/ios/LiveVoiceSdkReactNative.mm +247 -145
- package/ios/__SDK.h +16 -2
- package/ios/livevoice_spm_backport.rb +202 -0
- package/lib/module/components/BrandingView.js +71 -50
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +368 -54
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +17 -16
- package/lib/module/components/ErrorView.js.map +1 -1
- package/lib/module/components/LiveVoiceSpinner.js +81 -0
- package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
- package/lib/module/components/LiveVoiceView.js +351 -104
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PasswordPrompt.js +165 -0
- package/lib/module/components/PasswordPrompt.js.map +1 -0
- package/lib/module/components/PlayButtonView.js +192 -254
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +43 -62
- package/lib/module/components/ReconnectingView.js.map +1 -1
- package/lib/module/components/WarningView.js +12 -10
- package/lib/module/components/WarningView.js.map +1 -1
- package/lib/module/icons/branding-ios.png +0 -0
- package/lib/module/icons/camera-off-android.png +0 -0
- package/lib/module/icons/camera-off-android@2x.png +0 -0
- package/lib/module/icons/camera-off-android@3x.png +0 -0
- package/lib/module/icons/cpu-android.png +0 -0
- package/lib/module/icons/cpu-android@2x.png +0 -0
- package/lib/module/icons/cpu-android@3x.png +0 -0
- package/lib/module/icons/cpu-ios.png +0 -0
- package/lib/module/icons/cpu-ios@2x.png +0 -0
- package/lib/module/icons/cpu-ios@3x.png +0 -0
- package/lib/module/icons/lock-android.png +0 -0
- package/lib/module/icons/lock-android@2x.png +0 -0
- package/lib/module/icons/lock-android@3x.png +0 -0
- package/lib/module/icons/lock-ios.png +0 -0
- package/lib/module/icons/lock-ios@2x.png +0 -0
- package/lib/module/icons/lock-ios@3x.png +0 -0
- package/lib/module/icons/mic-off-android.png +0 -0
- package/lib/module/icons/mic-off-android@2x.png +0 -0
- package/lib/module/icons/mic-off-android@3x.png +0 -0
- package/lib/module/icons/mic-slash-ios.png +0 -0
- package/lib/module/icons/mic-slash-ios@2x.png +0 -0
- package/lib/module/icons/mic-slash-ios@3x.png +0 -0
- package/lib/module/icons/video-slash-ios.png +0 -0
- package/lib/module/icons/video-slash-ios@2x.png +0 -0
- package/lib/module/icons/video-slash-ios@3x.png +0 -0
- package/lib/module/index.js +24 -225
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/Bridge.js +236 -0
- package/lib/module/sdk/Bridge.js.map +1 -0
- package/lib/module/sdk/Event.js +160 -0
- package/lib/module/sdk/Event.js.map +1 -0
- package/lib/module/sdk/Lifecycle.js +331 -0
- package/lib/module/sdk/Lifecycle.js.map +1 -0
- package/lib/module/sdk/LiveVoiceSdk.js +365 -0
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
- package/lib/module/sdk/LiveVoiceState.js +234 -0
- package/lib/module/sdk/LiveVoiceState.js.map +1 -0
- package/lib/module/sdk/LogEntries.js +99 -0
- package/lib/module/sdk/LogEntries.js.map +1 -0
- package/lib/module/sdk/Models.js +2 -0
- package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
- package/lib/module/sdk/NativeSdkVersions.js +24 -0
- package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
- package/lib/module/sdk/Observables.js +391 -0
- package/lib/module/sdk/Observables.js.map +1 -0
- package/lib/module/sdk/Passwords.js +298 -0
- package/lib/module/sdk/Passwords.js.map +1 -0
- package/lib/module/sdk/Playback.js +35 -0
- package/lib/module/sdk/Playback.js.map +1 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +14 -11
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/module/util/Translations.js +46 -21
- package/lib/module/util/Translations.js.map +1 -1
- package/lib/module/util/freeze.js +26 -0
- package/lib/module/util/freeze.js.map +1 -0
- package/lib/module/util/logger.js +114 -0
- package/lib/module/util/logger.js.map +1 -0
- package/lib/typescript/src/components/BrandingView.d.ts +4 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
- package/lib/typescript/src/components/ChannelView.d.ts +29 -3
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
- package/lib/typescript/src/components/ErrorView.d.ts +5 -3
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
- package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
- package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
- package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
- package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +15 -144
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
- package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Event.d.ts +97 -0
- package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
- package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Models.d.ts +114 -0
- package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Observables.d.ts +123 -0
- package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
- package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Playback.d.ts +9 -0
- package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -1
- package/lib/typescript/src/util/Translations.d.ts +30 -8
- package/lib/typescript/src/util/Translations.d.ts.map +1 -1
- package/lib/typescript/src/util/freeze.d.ts +6 -0
- package/lib/typescript/src/util/freeze.d.ts.map +1 -0
- package/lib/typescript/src/util/logger.d.ts +33 -0
- package/lib/typescript/src/util/logger.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +41 -16
- package/package.json +26 -14
- package/src/components/BrandingView.tsx +55 -66
- package/src/components/ChannelView.tsx +342 -48
- package/src/components/ErrorView.tsx +21 -22
- package/src/components/LiveVoiceSpinner.tsx +87 -0
- package/src/components/LiveVoiceView.tsx +360 -151
- package/src/components/PasswordPrompt.tsx +144 -0
- package/src/components/PlayButtonView.tsx +177 -279
- package/src/components/ReconnectingView.tsx +40 -86
- package/src/components/WarningView.tsx +12 -10
- package/src/icons/branding-ios.png +0 -0
- package/src/icons/camera-off-android.png +0 -0
- package/src/icons/camera-off-android@2x.png +0 -0
- package/src/icons/camera-off-android@3x.png +0 -0
- package/src/icons/cpu-android.png +0 -0
- package/src/icons/cpu-android@2x.png +0 -0
- package/src/icons/cpu-android@3x.png +0 -0
- package/src/icons/cpu-ios.png +0 -0
- package/src/icons/cpu-ios@2x.png +0 -0
- package/src/icons/cpu-ios@3x.png +0 -0
- package/src/icons/lock-android.png +0 -0
- package/src/icons/lock-android@2x.png +0 -0
- package/src/icons/lock-android@3x.png +0 -0
- package/src/icons/lock-ios.png +0 -0
- package/src/icons/lock-ios@2x.png +0 -0
- package/src/icons/lock-ios@3x.png +0 -0
- package/src/icons/mic-off-android.png +0 -0
- package/src/icons/mic-off-android@2x.png +0 -0
- package/src/icons/mic-off-android@3x.png +0 -0
- package/src/icons/mic-slash-ios.png +0 -0
- package/src/icons/mic-slash-ios@2x.png +0 -0
- package/src/icons/mic-slash-ios@3x.png +0 -0
- package/src/icons/video-slash-ios.png +0 -0
- package/src/icons/video-slash-ios@2x.png +0 -0
- package/src/icons/video-slash-ios@3x.png +0 -0
- package/src/index.tsx +105 -252
- package/src/sdk/Bridge.ts +259 -0
- package/src/sdk/Event.ts +187 -0
- package/src/sdk/Lifecycle.ts +366 -0
- package/src/sdk/LiveVoiceSdk.ts +384 -0
- package/src/sdk/LiveVoiceState.ts +259 -0
- package/src/sdk/LogEntries.ts +88 -0
- package/src/sdk/Models.ts +129 -0
- package/src/sdk/NativeSdkVersions.ts +21 -0
- package/src/sdk/Observables.ts +414 -0
- package/src/sdk/Passwords.ts +286 -0
- package/src/sdk/Playback.ts +30 -0
- package/src/specs/NativeLiveVoiceSdk.ts +56 -46
- package/src/util/Colors.ts +14 -11
- package/src/util/Translations.ts +46 -22
- package/src/util/freeze.ts +23 -0
- package/src/util/logger.ts +119 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
- package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
- package/lib/module/components/AudioOutputSwitchView.js +0 -138
- package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/module/components/index.js +0 -22
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/icons/mic.png +0 -0
- package/lib/module/util/ForegroundServiceConfig.js +0 -28
- package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/module/util/PlayingState.js +0 -21
- package/lib/module/util/PlayingState.js.map +0 -1
- package/lib/module/util/UIState.js +0 -4
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/src/components/index.d.ts +0 -9
- package/lib/typescript/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/src/util/UIState.d.ts +0 -66
- package/lib/typescript/src/util/UIState.d.ts.map +0 -1
- package/src/components/AudioOutputSwitchView.tsx +0 -146
- package/src/components/index.tsx +0 -19
- package/src/icons/mic.png +0 -0
- package/src/util/ForegroundServiceConfig.tsx +0 -32
- package/src/util/PlayingState.ts +0 -18
- package/src/util/UIState.ts +0 -89
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** An event's colours, `'#RRGGBB'`, for the light and the dark appearance. */
|
|
2
|
+
export type LiveVoiceBrandColors = {
|
|
3
|
+
light: string;
|
|
4
|
+
dark: string;
|
|
5
|
+
};
|
|
6
|
+
/** The joined event. */
|
|
7
|
+
export type LiveVoiceEvent = {
|
|
8
|
+
eventId: number;
|
|
9
|
+
name: string;
|
|
10
|
+
/** `null` for an event without branding. */
|
|
11
|
+
brandColors: LiveVoiceBrandColors | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Where a requestable language stands:
|
|
15
|
+
* - `requestable`: it can be requested.
|
|
16
|
+
* - `requested`: a request is on its way, or the server confirmed or accepted it and its channel
|
|
17
|
+
* has not arrived yet. Requests of other listeners count.
|
|
18
|
+
* - `available`: an AI translation of the channel the requests translate exists in that
|
|
19
|
+
* language. A channel translating another channel does not count.
|
|
20
|
+
* - `unavailable`: the event excludes it, because it is spoken on the channel the requests
|
|
21
|
+
* translate.
|
|
22
|
+
*/
|
|
23
|
+
export type LiveVoiceLanguageRequestState = 'requestable' | 'requested' | 'available' | 'unavailable';
|
|
24
|
+
/** A language listeners can ask the event to add. */
|
|
25
|
+
export type LiveVoiceRequestableLanguage = {
|
|
26
|
+
languageCode: string;
|
|
27
|
+
/** The language's name in the device's language. */
|
|
28
|
+
localizedName: string;
|
|
29
|
+
/** The language's name in itself. */
|
|
30
|
+
autonym: string;
|
|
31
|
+
state: LiveVoiceLanguageRequestState;
|
|
32
|
+
};
|
|
33
|
+
/** An event linked to the joined one, to switch to with {@link switchToLinkedEvent}. */
|
|
34
|
+
export type LiveVoiceLinkedEvent = {
|
|
35
|
+
eventId: number;
|
|
36
|
+
name: string;
|
|
37
|
+
/** The event's join code; it is not secret. */
|
|
38
|
+
joinCode: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Asks the event to add a language and resolves once the server confirmed the request.
|
|
42
|
+
*
|
|
43
|
+
* The language shows `requested` in {@link getCurrentRequestableLanguages} shortly after, and
|
|
44
|
+
* what happens next shows there too. It never starts playback. Needs a `ready` connection and an
|
|
45
|
+
* API key that permits custom UI.
|
|
46
|
+
*
|
|
47
|
+
* @param languageCode - The `languageCode` of a language in state `requestable`.
|
|
48
|
+
* @throws {LiveVoiceError} `not_joined` unless the connection is `ready`; `api_key_invalid`
|
|
49
|
+
* without the custom-UI permission; `invalid_argument` for a code that is unknown or not
|
|
50
|
+
* requestable (also one already requested); `timed_out` when the server does not confirm within
|
|
51
|
+
* 10 seconds (the request may still exist); `network_failed`; `cancelled` when a leave, a new
|
|
52
|
+
* join or a switch ended it; `generic` with `detail.reason` `language_request_declined` or
|
|
53
|
+
* `language_request_failed`. See {@link LiveVoiceErrorCode}.
|
|
54
|
+
*/
|
|
55
|
+
export declare function requestLanguage(languageCode: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Withdraws the request for a language and resolves once the server confirmed the cancellation.
|
|
58
|
+
*
|
|
59
|
+
* The language shows `requestable` in {@link getCurrentRequestableLanguages} shortly after. A
|
|
60
|
+
* second cancellation of the same language waits for the first. Needs a `ready` connection and
|
|
61
|
+
* an API key that permits custom UI.
|
|
62
|
+
*
|
|
63
|
+
* @param languageCode - The `languageCode` of a language in state `requested`.
|
|
64
|
+
* @throws {LiveVoiceError} `not_joined` unless the connection is `ready`; `api_key_invalid`
|
|
65
|
+
* without the custom-UI permission; `invalid_argument` for a code that is unknown or not
|
|
66
|
+
* requested; `command_in_progress` while your own request for it is still being sent; `generic`
|
|
67
|
+
* with `detail.reason` `language_request_resolved` when the server decided first; `timed_out`
|
|
68
|
+
* when the server does not confirm within 10 seconds; `network_failed`; `cancelled` when a leave,
|
|
69
|
+
* a new join or a switch ended it; otherwise as {@link requestLanguage}. See
|
|
70
|
+
* {@link LiveVoiceErrorCode}.
|
|
71
|
+
*/
|
|
72
|
+
export declare function cancelLanguageRequest(languageCode: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Switches to a linked event and resolves once it is ready, with the same guarantees as
|
|
75
|
+
* `joinEvent`. Needs a `ready` connection and an API key that permits custom UI.
|
|
76
|
+
*
|
|
77
|
+
* When the promise resolves, the observed values already show the linked event, or the result of
|
|
78
|
+
* a newer call. Until then the connection is `joining` and the current event and its lists are
|
|
79
|
+
* `null`. After a completed switch the joined event stays valid: its `leave()` leaves the linked
|
|
80
|
+
* event. A leave while the switch is pending ends it with `cancelled` and leaves the event.
|
|
81
|
+
*
|
|
82
|
+
* A failed switch does not return to the previous event: the connection is `failed`, and
|
|
83
|
+
* `reconnect()` tries the linked event again if the error is retryable. The event is not checked
|
|
84
|
+
* against the linked events, so any event you have a join code for works.
|
|
85
|
+
*
|
|
86
|
+
* @param event - The event to switch to, usually one of {@link getCurrentLinkedEvents}.
|
|
87
|
+
* @throws {LiveVoiceError} `not_joined` when no event is ready and no switch is pending, also
|
|
88
|
+
* while reconnecting (the reconnect continues); `api_key_invalid` without the custom-UI
|
|
89
|
+
* permission; `superseded` when a newer switch or join replaced it; `cancelled` when a leave
|
|
90
|
+
* ended it; `timed_out` when the linked event was not ready within 30 seconds; otherwise why the
|
|
91
|
+
* join failed, such as `event_not_found`. See {@link LiveVoiceErrorCode}.
|
|
92
|
+
*/
|
|
93
|
+
export declare function switchToLinkedEvent(event: LiveVoiceLinkedEvent): Promise<void>;
|
|
94
|
+
export declare function decodeEvent(wire: unknown): LiveVoiceEvent | null;
|
|
95
|
+
export declare function decodeLanguages(wire: unknown): LiveVoiceRequestableLanguage[] | null;
|
|
96
|
+
export declare function decodeLinkedEvents(wire: unknown): LiveVoiceLinkedEvent[] | null;
|
|
97
|
+
//# sourceMappingURL=Event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../../src/sdk/Event.ts"],"names":[],"mappings":"AAoBA,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;I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O,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAO/E"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/** Every {@link LiveVoiceErrorCode}, for example to check a value at runtime. */
|
|
2
|
+
export declare const liveVoiceErrorCodes: readonly ["not_initialized", "not_joined", "invalid_argument", "superseded", "cancelled", "timed_out", "leave_incomplete", "command_in_progress", "api_key_invalid", "event_not_found", "event_inactive", "wrong_password", "listener_limit_reached", "network_failed", "no_network", "generic", "password_required", "unsupported_sdk", "channel_password_required", "channel_wrong_password", "channel_limit_reached", "channel_unavailable", "channel_forbidden", "channel_offline"];
|
|
3
|
+
/**
|
|
4
|
+
* What went wrong, the same codes on every platform. Each call names the codes specific to it.
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* - `not_initialized`: a call that needs `initialize()` was made before it resolved. Reading
|
|
8
|
+
* values, adding listeners and some setters work before it.
|
|
9
|
+
* - `invalid_argument`: an argument is malformed, or not allowed in the current state.
|
|
10
|
+
* - `not_joined`: the connection is not in a state the call allows; most calls need `ready`.
|
|
11
|
+
* - `superseded`: a newer call replaced a `joinEvent`, `reconnect` or `switchToLinkedEvent`. No
|
|
12
|
+
* other call fails with it.
|
|
13
|
+
* - `cancelled`: a leave, a newer command or a new join ended the call. Like `superseded` it
|
|
14
|
+
* needs no message to the user.
|
|
15
|
+
* - `timed_out`: no result within 30 seconds (join, switch, reconnect) or 10 seconds (a start or
|
|
16
|
+
* stop of playback, a subtitle start, the language calls).
|
|
17
|
+
* - `leave_incomplete`: local cleanup or an earlier stop has not finished within its deadline of
|
|
18
|
+
* 5 seconds. It comes from a leave (the event is left all the same), from a stop of playback
|
|
19
|
+
* while joining or failed, and from a start waiting behind an unfinished stop, which can be a
|
|
20
|
+
* stop in the current event. The cleanup is never abandoned; it continues.
|
|
21
|
+
* - `command_in_progress`: the same command is still running: an identical subtitle start, or
|
|
22
|
+
* the request a cancellation is meant to withdraw.
|
|
23
|
+
*
|
|
24
|
+
* Joining: `api_key_invalid` (also when the key does not permit custom UI, for a custom cell,
|
|
25
|
+
* `switchToLinkedEvent` and the language calls), `event_not_found`, `event_inactive`,
|
|
26
|
+
* `password_required` (no password was given), `wrong_password` (one was given and rejected),
|
|
27
|
+
* `listener_limit_reached`, `network_failed` (the connection failed or was lost, also before a
|
|
28
|
+
* call could reach the server), `no_network`, `unsupported_sdk` (the server requires a newer SDK,
|
|
29
|
+
* or the installed native SDK is not the version this package was built for), `generic` (see
|
|
30
|
+
* `detail.reason`).
|
|
31
|
+
*
|
|
32
|
+
* Channels and subtitles: `channel_password_required`, `channel_wrong_password`,
|
|
33
|
+
* `channel_limit_reached` (`detail.limitReason` is `participant` or `viewer`), `channel_offline`
|
|
34
|
+
* (a start of playback only; an offline channel's subtitles can be started),
|
|
35
|
+
* `channel_unavailable` (not part of the event, without audio, or a start of playback while
|
|
36
|
+
* reconnecting), `channel_forbidden`.
|
|
37
|
+
*/
|
|
38
|
+
export type LiveVoiceErrorCode = typeof liveVoiceErrorCodes[number];
|
|
39
|
+
/** Optional details of an error. */
|
|
40
|
+
export type LiveVoiceErrorDetail = {
|
|
41
|
+
/** The HTTP status of a failed request. */
|
|
42
|
+
httpStatus?: number;
|
|
43
|
+
/** The platform's own error code. */
|
|
44
|
+
platformCode?: number;
|
|
45
|
+
/** Which limit was reached. */
|
|
46
|
+
limitReason?: string;
|
|
47
|
+
/** A finer reason within the code, such as `stop_failed`. */
|
|
48
|
+
reason?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The error every LiveVoice call rejects with, and the one a `failed` connection carries. Its
|
|
52
|
+
* `message` is localised text to show as is. Codes only a developer can fix (`invalid_argument`,
|
|
53
|
+
* `not_initialized`, `api_key_invalid`, `unsupported_sdk`) share a generic text; the SDK log
|
|
54
|
+
* explains them.
|
|
55
|
+
*/
|
|
56
|
+
export declare class LiveVoiceError extends Error {
|
|
57
|
+
/** What went wrong; stable, for your own handling. */
|
|
58
|
+
readonly code: LiveVoiceErrorCode;
|
|
59
|
+
/** Whether trying again can succeed; it follows from the code. */
|
|
60
|
+
readonly isRetryable: boolean;
|
|
61
|
+
/** Optional details, `{}` when there are none. */
|
|
62
|
+
readonly detail: LiveVoiceErrorDetail;
|
|
63
|
+
/**
|
|
64
|
+
* Creates an error, for tests and previews.
|
|
65
|
+
*
|
|
66
|
+
* @param code - What went wrong; `isRetryable` follows from it.
|
|
67
|
+
* @param options - `detail`: extra information for some codes. `message`: the text to show;
|
|
68
|
+
* leave it out or pass `null` for the code's localised text.
|
|
69
|
+
*/
|
|
70
|
+
constructor(code: LiveVoiceErrorCode, options?: {
|
|
71
|
+
detail?: LiveVoiceErrorDetail;
|
|
72
|
+
message?: string | null;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/** When the next reconnect attempt runs. */
|
|
76
|
+
export type LiveVoiceRetry = {
|
|
77
|
+
kind: 'inProgress';
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'scheduled';
|
|
80
|
+
at: Date;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The connection to the event:
|
|
84
|
+
* - `idle`: nothing is joined or joining; also before `initialize()`.
|
|
85
|
+
* - `joining`: a join, a switch to a linked event, or the retry of a failed join is in progress.
|
|
86
|
+
* - `ready`: the event `eventId` is joined.
|
|
87
|
+
* - `reconnecting`: the connection was lost and is recovering; see `retry`. A `reconnect()` that
|
|
88
|
+
* times out leaves it here, and recovery continues.
|
|
89
|
+
* - `leaving`: a leave is running.
|
|
90
|
+
* - `failed`: a join, a switch or the retry of a join failed, or the joined event ended, with
|
|
91
|
+
* `error`. The join is kept: `reconnect()` retries it if the error is retryable, and
|
|
92
|
+
* `stopChannel` and `stopSubtitles` still work. It stays until that retry, a new join or a
|
|
93
|
+
* leave.
|
|
94
|
+
*
|
|
95
|
+
* Use it for display. To know that a call completed, await the call.
|
|
96
|
+
*/
|
|
97
|
+
export type LiveVoiceConnection = {
|
|
98
|
+
status: 'idle' | 'joining' | 'leaving';
|
|
99
|
+
} | {
|
|
100
|
+
status: 'ready';
|
|
101
|
+
eventId: number;
|
|
102
|
+
} | {
|
|
103
|
+
status: 'reconnecting';
|
|
104
|
+
eventId: number;
|
|
105
|
+
retry: LiveVoiceRetry;
|
|
106
|
+
} | {
|
|
107
|
+
status: 'failed';
|
|
108
|
+
error: LiveVoiceError;
|
|
109
|
+
};
|
|
110
|
+
/** What `joinEvent` joins with. */
|
|
111
|
+
export type LiveVoiceJoinRequest = {
|
|
112
|
+
/**
|
|
113
|
+
* The code listeners join the event with: six characters, digits and the letters
|
|
114
|
+
* `ABCDEFGHJKLMNPQRST`, in either case.
|
|
115
|
+
*/
|
|
116
|
+
joinCode: string;
|
|
117
|
+
/**
|
|
118
|
+
* The event's password, if it has one. A password you pass is final: a wrong one fails with
|
|
119
|
+
* `wrong_password` without a prompt. Without one, a protected event's password comes from the
|
|
120
|
+
* SDK's memory, the password store, then the password provider or the built-in prompt.
|
|
121
|
+
*/
|
|
122
|
+
password?: string | null;
|
|
123
|
+
/** Your API key, from your LiveVoice account page. */
|
|
124
|
+
apiKey: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The joined event `joinEvent` returns. It follows a completed switch to a linked event.
|
|
128
|
+
*
|
|
129
|
+
* Its `leave()` leaves only the join this came from, including a linked event it switched to; it
|
|
130
|
+
* can never leave a newer join. If a newer join replaced its join, it does nothing and resolves at
|
|
131
|
+
* once. Otherwise it resolves as `leaveEvent` does: the event's local cleanup has ended, and the
|
|
132
|
+
* observed connection is `idle` unless a newer join exists. If its join was already left, it
|
|
133
|
+
* waits for that leave's cleanup.
|
|
134
|
+
*
|
|
135
|
+
* `leave()` rejects with a {@link LiveVoiceError} `leave_incomplete` when the cleanup has not
|
|
136
|
+
* finished within 5 seconds; the event is left all the same and the cleanup continues. Another
|
|
137
|
+
* leave then waits for the same cleanup and can fail with `leave_incomplete` again.
|
|
138
|
+
*/
|
|
139
|
+
export type LiveVoiceJoinedEvent = {
|
|
140
|
+
leave(): Promise<void>;
|
|
141
|
+
};
|
|
142
|
+
export declare function normalizeError(error: unknown): LiveVoiceError;
|
|
143
|
+
/**
|
|
144
|
+
* A developer-only error the wrapper throws itself (bridge.md 3.6): its message is the generic
|
|
145
|
+
* text, and its explanation, a fixed sentence without argument values, goes to the SDK log as
|
|
146
|
+
* `LV_USAGE_ERROR`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function usageError(code: 'invalid_argument' | 'not_initialized', operation: string, explanation: string): LiveVoiceError;
|
|
149
|
+
/**
|
|
150
|
+
* Runs `command` natively. Before `initialize()` it fails with `not_initialized` without reaching
|
|
151
|
+
* native, the only error the wrapper owns (bridge.md 3.1). A reply that is not JSON resolves as
|
|
152
|
+
* `undefined`: native succeeded, so the call does too.
|
|
153
|
+
*/
|
|
154
|
+
export declare function invoke(command: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
155
|
+
export declare function join(request: LiveVoiceJoinRequest): Promise<LiveVoiceJoinedEvent>;
|
|
156
|
+
export declare function channelId(id: number, operation: string): number;
|
|
157
|
+
/** A retry as the cache keeps it: the time in milliseconds, so every delivery gets its own `Date`. */
|
|
158
|
+
export type RetryValue = {
|
|
159
|
+
kind: 'inProgress';
|
|
160
|
+
} | {
|
|
161
|
+
kind: 'scheduled';
|
|
162
|
+
at: number;
|
|
163
|
+
};
|
|
164
|
+
/** The connection as the cache keeps it, with the retry time in milliseconds. */
|
|
165
|
+
export type ConnectionValue = {
|
|
166
|
+
status: 'idle' | 'joining' | 'leaving';
|
|
167
|
+
} | {
|
|
168
|
+
status: 'ready';
|
|
169
|
+
eventId: number;
|
|
170
|
+
} | {
|
|
171
|
+
status: 'reconnecting';
|
|
172
|
+
eventId: number;
|
|
173
|
+
retry: RetryValue;
|
|
174
|
+
} | {
|
|
175
|
+
status: 'failed';
|
|
176
|
+
error: LiveVoiceError;
|
|
177
|
+
};
|
|
178
|
+
/** The wire's retry, or `undefined` when it is malformed. */
|
|
179
|
+
export declare function decodeRetry(wire: unknown): RetryValue | undefined;
|
|
180
|
+
/** A public retry, with a `Date` of its own. */
|
|
181
|
+
export declare function publicRetry(retry: RetryValue): LiveVoiceRetry;
|
|
182
|
+
/** The wire's error as a `LiveVoiceError`; anything else becomes `generic`. */
|
|
183
|
+
export declare function decodeError(wire: unknown): LiveVoiceError;
|
|
184
|
+
/** The wire's connection (bridge.md 2.3); throws for one it cannot read. */
|
|
185
|
+
export declare function decodeConnection(wire: unknown): ConnectionValue;
|
|
186
|
+
/**
|
|
187
|
+
* The public connection. A scheduled retry gets a `Date` of its own on every call, so changing one
|
|
188
|
+
* changes no other; every other connection is the cached value itself.
|
|
189
|
+
*/
|
|
190
|
+
export declare function publicConnection(value: ConnectionValue): LiveVoiceConnection;
|
|
191
|
+
//# sourceMappingURL=Lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/sdk/Lifecycle.ts"],"names":[],"mappings":"AAiBA,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,ydAyBtB,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAEpE,oCAAoC;AACpC,MAAM,MAAM,oBAAoB,GAAG;IACjC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAyCF;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;I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CAkB/D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,mBAAmB,CAK5E"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { type ImageSourcePropType } from 'react-native';
|
|
2
|
+
import { type LiveVoiceJoinRequest, type LiveVoiceJoinedEvent } from './Lifecycle';
|
|
3
|
+
import { type LiveVoiceAudioOutput } from './Models';
|
|
4
|
+
/**
|
|
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.
|
|
11
|
+
*
|
|
12
|
+
* iOS interruptions pause LiveVoice in every mode. Android's automatic focus-loss handling
|
|
13
|
+
* applies only when LiveVoice owns audio focus.
|
|
14
|
+
*/
|
|
15
|
+
export type LiveVoiceAudioFocus = 'exclusive' | 'duckOthers' | 'hostManaged';
|
|
16
|
+
/**
|
|
17
|
+
* Android only: whether a foreground service keeps playback alive while your app is in the
|
|
18
|
+
* background. Ignored on iOS.
|
|
19
|
+
*/
|
|
20
|
+
export type LiveVoiceForegroundServiceConfig = {
|
|
21
|
+
kind: 'disabled';
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'enabled';
|
|
24
|
+
};
|
|
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;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Initializes the LiveVoice SDK. Await it before joining an event; reading values and adding
|
|
44
|
+
* listeners works before it.
|
|
45
|
+
*
|
|
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.
|
|
49
|
+
*
|
|
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.
|
|
53
|
+
*/
|
|
54
|
+
export declare function initialize(options?: LiveVoiceInitializeOptions): Promise<void>;
|
|
55
|
+
/**
|
|
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.
|
|
59
|
+
*
|
|
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.
|
|
67
|
+
*
|
|
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>;
|
|
193
|
+
/**
|
|
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.
|
|
207
|
+
*/
|
|
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;
|
|
211
|
+
/**
|
|
212
|
+
* Returns the version of the native LiveVoice SDK this package uses, for example `"3.0.0"`.
|
|
213
|
+
*/
|
|
214
|
+
export declare function getNativeSdkVersion(): string;
|
|
215
|
+
//# sourceMappingURL=LiveVoiceSdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveVoiceSdk.d.ts","sourceRoot":"","sources":["../../../../src/sdk/LiveVoiceSdk.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAIzE,OAAO,EAML,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,YAAY,GAAG,aAAa,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GACxC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,SAAS,CAAA;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AC,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"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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): {
|
|
76
|
+
remove: () => void;
|
|
77
|
+
};
|
|
78
|
+
/** A wire channel (bridge.md 2.2) as the public `LiveVoiceChannel`. */
|
|
79
|
+
export declare function decodeChannel(wire: Record<string, unknown>): LiveVoiceChannel;
|
|
80
|
+
//# sourceMappingURL=LiveVoiceState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveVoiceState.d.ts","sourceRoot":"","sources":["../../../../src/sdk/LiveVoiceState.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA4B,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EAEvB,MAAM,UAAU,CAAC;AAGlB,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,kFAAkF;AAClF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,+DAA+D;IAC/D,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;IAClC,2EAA2E;IAC3E,OAAO,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnD,CAAC;AAEF,0FAA0F;AAC1F,MAAM,MAAM,UAAU,GAAG;IACvB,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AA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E;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"}
|