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
|
@@ -1,98 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
import React, { useEffect } from 'react';
|
|
13
|
-
import { View, Text, useColorScheme, StyleSheet
|
|
15
|
+
import { View, Text, useColorScheme, StyleSheet } from 'react-native';
|
|
14
16
|
import { COLORS } from '../util/Colors';
|
|
15
17
|
|
|
16
|
-
import { type
|
|
18
|
+
import { type RetryValue } from '../sdk/Lifecycle';
|
|
17
19
|
import { Translations } from '../util/Translations';
|
|
20
|
+
import { LiveVoiceSpinner } from './LiveVoiceSpinner';
|
|
18
21
|
|
|
19
22
|
export interface ReconnectingProps {
|
|
20
23
|
isDarkMode?: boolean
|
|
21
|
-
|
|
22
|
-
onPress: () => void
|
|
24
|
+
retry: RetryValue
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The default reconnecting part. The reconnect runs by itself, so it has no retry-now button; the
|
|
29
|
+
* error part has the retry.
|
|
30
|
+
*/
|
|
25
31
|
export const ReconnectingView: React.FC<ReconnectingProps> = (props) => {
|
|
26
32
|
const isDarkMode = props.isDarkMode ?? useColorScheme() === 'dark';
|
|
27
|
-
const
|
|
28
|
-
const isAttemptOngoing = reconnectingState.state.type === 'inProgress';
|
|
33
|
+
const { retry } = props;
|
|
29
34
|
|
|
30
|
-
const [
|
|
35
|
+
const [secondsUntilRetry, setSecondsUntilRetry] = React.useState(() => secondsUntil(retry));
|
|
31
36
|
|
|
32
|
-
//
|
|
37
|
+
// Count down every second.
|
|
33
38
|
useEffect(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const interval = setInterval(() => {
|
|
39
|
-
const newValue = calculateSecondsUntilRetry(reconnectingState)
|
|
40
|
-
console.log('Updated seconds' + newValue)
|
|
41
|
-
setSecUntilRetry(newValue);
|
|
42
|
-
}, 1000);
|
|
43
|
-
|
|
44
|
-
return () => clearInterval(interval); // Clean up when unmounted
|
|
45
|
-
}, [reconnectingState]);
|
|
39
|
+
setSecondsUntilRetry(secondsUntil(retry));
|
|
40
|
+
const interval = setInterval(() => setSecondsUntilRetry(secondsUntil(retry)), 1000);
|
|
41
|
+
return () => clearInterval(interval);
|
|
42
|
+
}, [retry]);
|
|
46
43
|
|
|
44
|
+
const textColor = isDarkMode ? COLORS.white : COLORS.black;
|
|
47
45
|
return (
|
|
48
46
|
<View
|
|
49
47
|
style={[
|
|
50
48
|
styles.container,
|
|
51
49
|
isDarkMode ? { backgroundColor: COLORS.cardBgDark } : { backgroundColor: COLORS.cardBg }
|
|
52
50
|
]}>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{reconnectingState.state.type === 'awaitingRetry'
|
|
57
|
-
? Translations.errorScreenRetryingIn(secUntilRetry)
|
|
51
|
+
<Text style={[styles.text, { color: textColor }]}>
|
|
52
|
+
{retry.kind === 'scheduled'
|
|
53
|
+
? Translations.errorScreenRetryingIn(secondsUntilRetry)
|
|
58
54
|
: Translations.errorScreenRetrying()}
|
|
59
55
|
</Text>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onPress={props.onPress}
|
|
64
|
-
activeOpacity={0.9}
|
|
65
|
-
style={[
|
|
66
|
-
styles.button,
|
|
67
|
-
{
|
|
68
|
-
minWidth: 100, // fixed width, so it doesn't change size when showing the ActivityIndicator
|
|
69
|
-
backgroundColor: isDarkMode ? '#fff' : '#191919',
|
|
70
|
-
},
|
|
71
|
-
]}
|
|
72
|
-
>
|
|
73
|
-
{isAttemptOngoing
|
|
74
|
-
? (
|
|
75
|
-
<ActivityIndicator
|
|
76
|
-
size='small'
|
|
77
|
-
color={isDarkMode ? '#191919' : '#fff'}
|
|
78
|
-
/>
|
|
79
|
-
)
|
|
80
|
-
: (
|
|
81
|
-
<Text
|
|
82
|
-
style={[
|
|
83
|
-
styles.buttonText,
|
|
84
|
-
isDarkMode ? styles.lightText : styles.darkText,
|
|
85
|
-
]}>
|
|
86
|
-
{Translations.errorRetryNowButton()}
|
|
87
|
-
</Text>
|
|
88
|
-
)}
|
|
89
|
-
</TouchableOpacity>
|
|
56
|
+
<View style={styles.spinner}>
|
|
57
|
+
<LiveVoiceSpinner size={36} color={textColor} />
|
|
58
|
+
</View>
|
|
90
59
|
</View>
|
|
91
60
|
);
|
|
92
61
|
};
|
|
93
62
|
|
|
94
|
-
function
|
|
95
|
-
|
|
63
|
+
function secondsUntil(retry: RetryValue): number {
|
|
64
|
+
if (retry.kind !== 'scheduled') return 0;
|
|
65
|
+
return Math.max(0, Math.ceil((retry.at - Date.now()) / 1000));
|
|
96
66
|
}
|
|
97
67
|
|
|
98
68
|
const styles = StyleSheet.create({
|
|
@@ -109,25 +79,9 @@ const styles = StyleSheet.create({
|
|
|
109
79
|
fontWeight: '500',
|
|
110
80
|
textAlign: 'center',
|
|
111
81
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
darkText: {
|
|
116
|
-
color: '#fff',
|
|
117
|
-
},
|
|
118
|
-
lightText: {
|
|
119
|
-
color: '#191919',
|
|
120
|
-
},
|
|
121
|
-
button: {
|
|
122
|
-
paddingHorizontal: 10,
|
|
123
|
-
paddingVertical: 8,
|
|
124
|
-
borderRadius: 8,
|
|
82
|
+
// Muted, as on the native SDKs: it says the SDK is working, the text says what on.
|
|
83
|
+
spinner: {
|
|
125
84
|
marginTop: 10,
|
|
126
|
-
|
|
127
|
-
buttonText: {
|
|
128
|
-
color: '#fff',
|
|
129
|
-
fontSize: 14,
|
|
130
|
-
fontWeight: '500',
|
|
131
|
-
textAlign: 'center',
|
|
85
|
+
opacity: 0.5,
|
|
132
86
|
},
|
|
133
87
|
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
import React from 'react';
|
|
13
15
|
import { View, Text, useColorScheme, StyleSheet } from 'react-native';
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/index.tsx
CHANGED
|
@@ -1,252 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return JSON.parse(LiveVoiceSdkReactNative.getCurrentUiState());
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Get the current available subtitle configurations LiveVoice SDK.
|
|
111
|
-
*
|
|
112
|
-
* @abstract You should only need to call this method to get an initial value. Use {@link onAvailableSubtitleConfigsChanged}
|
|
113
|
-
` to be updated when the available subtitle configurations change.
|
|
114
|
-
* @returns {[AvailableSubtitle]} The current available subtitles
|
|
115
|
-
*/
|
|
116
|
-
export function getCurrentSubtitleConfiguration(): [AvailableSubtitle] {
|
|
117
|
-
return JSON.parse(
|
|
118
|
-
LiveVoiceSdkReactNative.getCurrentAvailableSubtitleConfigs(),
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get the current subtitle elemens LiveVoice SDK.
|
|
124
|
-
*
|
|
125
|
-
* @abstract You should only need to call this method to get an initial value. Use {@link onSubtitlesChanged}
|
|
126
|
-
` to be updated when the new subtitles are added.
|
|
127
|
-
* @returns {[String]} The current subtitles
|
|
128
|
-
*/
|
|
129
|
-
export function getCurrentSubtitles(): [String] {
|
|
130
|
-
return JSON.parse(LiveVoiceSdkReactNative.getCurrentSubtitles());
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Get the current state of the audio output.
|
|
135
|
-
*
|
|
136
|
-
* @abstract You should only need to call this method to get an initial value. Use {@link onAudioOutputChanged}
|
|
137
|
-
` to be updated about the audio state.
|
|
138
|
-
* @returns {boolean} `true` for the speaker and `false` for the receiver.
|
|
139
|
-
*/
|
|
140
|
-
export function getCurrentAudioState(): boolean {
|
|
141
|
-
return LiveVoiceSdkReactNative.getCurrentAudioState();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Set the audio output.
|
|
146
|
-
* @param {boolean} value - Set to `true` to use the speaker, and `false` to use the receiver.
|
|
147
|
-
*/
|
|
148
|
-
export function setLiveVoiceUseSpeaker(value: boolean): void {
|
|
149
|
-
return LiveVoiceSdkReactNative.setLiveVoiceUseSpeaker(value);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Start playing a channel.
|
|
154
|
-
* @abstract You can find the channel ID for a channel in the admin web-interface at the bottom when tapping *Edit Channel*.
|
|
155
|
-
* @param {number} [id] - The channel ID.
|
|
156
|
-
*/
|
|
157
|
-
export function startChannel(id: number): void {
|
|
158
|
-
return LiveVoiceSdkReactNative.startChannel(id);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Stop playing the currently playing channel.
|
|
163
|
-
*/
|
|
164
|
-
export function stopChannel(): void {
|
|
165
|
-
return LiveVoiceSdkReactNative.stopChannel();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Start receiving subtitles.
|
|
170
|
-
* @abstract The SDK can receive a single stream of subtitle fragments at a time.
|
|
171
|
-
* You can stop receiving subtitles using {@link stopSubtitles()}.
|
|
172
|
-
* Whenever you call this method, any previous subtitle streams are stopped automatically and you receive the subtitles for the requested channel and language instead.
|
|
173
|
-
*
|
|
174
|
-
* 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.
|
|
175
|
-
*
|
|
176
|
-
* @param {number | null} channelId - The channel to receive subtitles for. Set to `null` to always receive subtitles for the currently playing channel.
|
|
177
|
-
*/
|
|
178
|
-
export function startSubtitles(channelId: number | null) {
|
|
179
|
-
const nativeSafeId = channelId == null ? -1 : channelId;
|
|
180
|
-
LiveVoiceSdkReactNative.startSubtitles(nativeSafeId);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Stop receiving subtitles.
|
|
185
|
-
*/
|
|
186
|
-
export function stopSubtitles(): void {
|
|
187
|
-
return LiveVoiceSdkReactNative.stopSubtitles();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Event handlers
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Handle changes of the audio output.
|
|
194
|
-
*
|
|
195
|
-
* @returns {object} - An object with a `remove` method to unsubscribe from the event.
|
|
196
|
-
*/
|
|
197
|
-
export function onAudioOutputChanged(handler: (useSpeaker: boolean) => void): {
|
|
198
|
-
remove: () => void;
|
|
199
|
-
} {
|
|
200
|
-
return LiveVoiceSdkReactNative.onAudioOutputChanged((data: boolean) => {
|
|
201
|
-
handler(data);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Handle changes of the UI state.
|
|
207
|
-
*
|
|
208
|
-
* @returns {object} - An object with a `remove` method to unsubscribe from the event.
|
|
209
|
-
*/
|
|
210
|
-
export function onUiStateChanged(handler: (arg: UiState) => void): {
|
|
211
|
-
remove: () => void;
|
|
212
|
-
} {
|
|
213
|
-
return LiveVoiceSdkReactNative.onUiStateChanged((data: string) => {
|
|
214
|
-
handler(JSON.parse(data));
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Handle changes of the available subtitles.
|
|
220
|
-
*
|
|
221
|
-
* @returns { object } - An object with a`remove` method to unsubscribe from the event.
|
|
222
|
-
*/
|
|
223
|
-
export function onAvailableSubtitleConfigsChanged(
|
|
224
|
-
handler: (arg: [AvailableSubtitle]) => void,
|
|
225
|
-
): { remove: () => void } {
|
|
226
|
-
return LiveVoiceSdkReactNative.onAvailableSubtitleConfigsChanged(
|
|
227
|
-
(data: string) => {
|
|
228
|
-
handler(JSON.parse(data));
|
|
229
|
-
},
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Handle changes of the available subtitles.
|
|
235
|
-
*
|
|
236
|
-
* @returns {object} - An object with a `remove` method to unsubscribe from the event.
|
|
237
|
-
*/
|
|
238
|
-
export function onSubtitlesChanged(handler: (arg: [String]) => void): {
|
|
239
|
-
remove: () => void;
|
|
240
|
-
} {
|
|
241
|
-
return LiveVoiceSdkReactNative.onSubtitlesChanged((data: string) => {
|
|
242
|
-
const mapOfSubtitles: [String] = JSON.parse(data);
|
|
243
|
-
handler(mapOfSubtitles);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Open the LiveVoice website in the device's default browser.
|
|
249
|
-
*/
|
|
250
|
-
export function openLiveVoiceWebsite(): void {
|
|
251
|
-
return LiveVoiceSdkReactNative.openLiveVoiceWebsite();
|
|
252
|
-
}
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
// The public API, by name. Everything else is internal: the parts of the default view, the
|
|
15
|
+
// texts and the bridge plumbing.
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
initialize,
|
|
19
|
+
joinEvent,
|
|
20
|
+
leaveEvent,
|
|
21
|
+
reconnect,
|
|
22
|
+
stopChannel,
|
|
23
|
+
startSubtitles,
|
|
24
|
+
stopSubtitles,
|
|
25
|
+
setAudioOutput,
|
|
26
|
+
setNowPlayingArtwork,
|
|
27
|
+
openLiveVoiceWebsite,
|
|
28
|
+
getSdkVersion,
|
|
29
|
+
getNativeSdkVersion,
|
|
30
|
+
} from './sdk/LiveVoiceSdk';
|
|
31
|
+
export type {
|
|
32
|
+
LiveVoiceAudioFocus,
|
|
33
|
+
LiveVoiceForegroundServiceConfig,
|
|
34
|
+
LiveVoiceInitializeOptions,
|
|
35
|
+
} from './sdk/LiveVoiceSdk';
|
|
36
|
+
export {
|
|
37
|
+
getCurrentConnection,
|
|
38
|
+
addConnectionListener,
|
|
39
|
+
useLiveVoiceConnection,
|
|
40
|
+
getCurrentSubtitles,
|
|
41
|
+
addSubtitlesListener,
|
|
42
|
+
useLiveVoiceSubtitles,
|
|
43
|
+
getCurrentAvailableSubtitles,
|
|
44
|
+
addAvailableSubtitlesListener,
|
|
45
|
+
useLiveVoiceAvailableSubtitles,
|
|
46
|
+
getCurrentAudioOutput,
|
|
47
|
+
addAudioOutputListener,
|
|
48
|
+
useLiveVoiceAudioOutput,
|
|
49
|
+
getCurrentFeatures,
|
|
50
|
+
addFeaturesListener,
|
|
51
|
+
useLiveVoiceFeatures,
|
|
52
|
+
getCurrentEvent,
|
|
53
|
+
addCurrentEventListener,
|
|
54
|
+
useLiveVoiceCurrentEvent,
|
|
55
|
+
getCurrentRequestableLanguages,
|
|
56
|
+
addRequestableLanguagesListener,
|
|
57
|
+
useLiveVoiceRequestableLanguages,
|
|
58
|
+
getCurrentLinkedEvents,
|
|
59
|
+
addLinkedEventsListener,
|
|
60
|
+
useLiveVoiceLinkedEvents,
|
|
61
|
+
} from './sdk/Observables';
|
|
62
|
+
export { LiveVoiceError, liveVoiceErrorCodes } from './sdk/Lifecycle';
|
|
63
|
+
export type {
|
|
64
|
+
LiveVoiceConnection,
|
|
65
|
+
LiveVoiceErrorCode,
|
|
66
|
+
LiveVoiceErrorDetail,
|
|
67
|
+
LiveVoiceJoinedEvent,
|
|
68
|
+
LiveVoiceJoinRequest,
|
|
69
|
+
LiveVoiceRetry,
|
|
70
|
+
} from './sdk/Lifecycle';
|
|
71
|
+
export type {
|
|
72
|
+
LiveVoiceAiTranslationInfo,
|
|
73
|
+
LiveVoiceAudioOutput,
|
|
74
|
+
LiveVoiceAvailableSubtitle,
|
|
75
|
+
LiveVoiceChannel,
|
|
76
|
+
LiveVoiceDependentChannel,
|
|
77
|
+
LiveVoiceFeatures,
|
|
78
|
+
LiveVoicePlayingState,
|
|
79
|
+
LiveVoiceSubscription,
|
|
80
|
+
LiveVoiceSubtitleState,
|
|
81
|
+
} from './sdk/Models';
|
|
82
|
+
export { requestLanguage, cancelLanguageRequest, switchToLinkedEvent } from './sdk/Event';
|
|
83
|
+
export type {
|
|
84
|
+
LiveVoiceBrandColors,
|
|
85
|
+
LiveVoiceEvent,
|
|
86
|
+
LiveVoiceLanguageRequestState,
|
|
87
|
+
LiveVoiceLinkedEvent,
|
|
88
|
+
LiveVoiceRequestableLanguage,
|
|
89
|
+
} from './sdk/Event';
|
|
90
|
+
export { setPasswordProvider, setPasswordStore } from './sdk/Passwords';
|
|
91
|
+
export type {
|
|
92
|
+
LiveVoicePasswordProvider,
|
|
93
|
+
LiveVoicePasswordRequest,
|
|
94
|
+
LiveVoicePasswordStore,
|
|
95
|
+
LiveVoicePasswordSubject,
|
|
96
|
+
} from './sdk/Passwords';
|
|
97
|
+
export { addLogListener } from './sdk/LogEntries';
|
|
98
|
+
export type { LiveVoiceLogEntry, LiveVoiceLogLevel, LiveVoiceLogListener } from './sdk/LogEntries';
|
|
99
|
+
export { LiveVoiceView } from './components/LiveVoiceView';
|
|
100
|
+
export { Translations } from './util/Translations';
|
|
101
|
+
export type {
|
|
102
|
+
LiveVoiceChannelCell,
|
|
103
|
+
LiveVoiceEmptyReason,
|
|
104
|
+
LiveVoiceViewProps,
|
|
105
|
+
} from './components/LiveVoiceView';
|