livevoice-sdk-react-native 1.0.3 → 2.0.1
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/LICENSE +1 -1
- package/README.md +119 -7
- package/android/build.gradle +52 -84
- package/android/gradle.properties +10 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +93 -126
- package/android/src/main/java/io/livevoice/react/LiveVoiceSdkReactNativePackage.kt +12 -13
- package/android/src/main/java/io/livevoice/react/__SDK.kt +16 -2
- package/ios/LiveVoiceSdkReactNative.h +5 -5
- package/ios/LiveVoiceSdkReactNative.mm +308 -0
- package/ios/__SDK.h +16 -2
- package/lib/module/components/AudioOutputSwitchView.js +13 -13
- package/lib/module/components/AudioOutputSwitchView.js.map +1 -1
- package/lib/module/components/BrandingView.js +13 -11
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +27 -48
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +12 -10
- package/lib/module/components/ErrorView.js.map +1 -1
- package/lib/module/components/LiveVoiceView.js +153 -61
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PlayButtonView.js +255 -94
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +16 -13
- 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/components/index.js +12 -10
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/icons/captions@1x.png +0 -0
- package/lib/module/icons/captions@2x.png +0 -0
- package/lib/module/icons/pause@1x.png +0 -0
- package/lib/module/icons/pause@2x.png +0 -0
- package/lib/module/icons/play@1x.png +0 -0
- package/lib/module/icons/play@2x.png +0 -0
- package/lib/module/index.js +14 -222
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/LiveVoiceSdk.js +371 -0
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
- package/lib/module/sdk/LiveVoiceState.js +66 -0
- package/lib/module/sdk/LiveVoiceState.js.map +1 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js +16 -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/ForegroundServiceConfig.js +21 -11
- package/lib/module/util/ForegroundServiceConfig.js.map +1 -1
- package/lib/module/util/PlayingState.js +12 -10
- package/lib/module/util/PlayingState.js.map +1 -1
- package/lib/module/util/Translations.js +12 -10
- package/lib/module/util/Translations.js.map +1 -1
- package/lib/module/util/logger.js +76 -0
- package/lib/module/util/logger.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/components/ChannelView.d.ts +4 -2
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -0
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts +28 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +341 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -0
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -0
- package/lib/typescript/src/components/WarningView.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +210 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +12 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
- package/lib/typescript/{module/src → src}/specs/NativeLiveVoiceSdk.d.ts +6 -3
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/util/Colors.d.ts +2 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -0
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +19 -0
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -0
- package/lib/typescript/src/util/PlayingState.d.ts.map +1 -0
- package/lib/typescript/src/util/Translations.d.ts.map +1 -0
- package/lib/typescript/src/util/UIState.d.ts +86 -0
- package/lib/typescript/src/util/UIState.d.ts.map +1 -0
- package/lib/typescript/src/util/logger.d.ts +23 -0
- package/lib/typescript/src/util/logger.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +20 -41
- package/package.json +41 -122
- package/src/components/AudioOutputSwitchView.tsx +13 -13
- package/src/components/BrandingView.tsx +13 -11
- package/src/components/ChannelView.tsx +32 -36
- package/src/components/ErrorView.tsx +12 -10
- package/src/components/LiveVoiceView.tsx +231 -89
- package/src/components/PlayButtonView.tsx +293 -98
- package/src/components/ReconnectingView.tsx +20 -13
- package/src/components/WarningView.tsx +12 -10
- package/src/components/index.tsx +12 -10
- package/src/icons/captions@1x.png +0 -0
- package/src/icons/captions@2x.png +0 -0
- package/src/icons/pause@1x.png +0 -0
- package/src/icons/pause@2x.png +0 -0
- package/src/icons/play@1x.png +0 -0
- package/src/icons/play@2x.png +0 -0
- package/src/index.tsx +19 -236
- package/src/sdk/LiveVoiceSdk.ts +408 -0
- package/src/sdk/LiveVoiceState.ts +89 -0
- package/src/specs/NativeLiveVoiceSdk.ts +24 -16
- package/src/util/Colors.ts +15 -11
- package/src/util/ForegroundServiceConfig.tsx +21 -11
- package/src/util/PlayingState.ts +12 -10
- package/src/util/Translations.ts +12 -10
- package/src/util/UIState.ts +54 -13
- package/src/util/logger.ts +92 -0
- package/android/generated/java/io/livevoice/react/NativeLiveVoiceSdkSpec.java +0 -186
- package/android/generated/jni/CMakeLists.txt +0 -36
- package/android/generated/jni/RNLiveVoiceSpec-generated.cpp +0 -235
- package/android/generated/jni/RNLiveVoiceSpec.h +0 -31
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -398
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -54
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -77
- package/ios/LivevoiceSdkReactNative.mm +0 -250
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec-generated.mm +0 -292
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec.h +0 -101
- package/ios/generated/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/ios/generated/RNLiveVoiceSpecJSI.h +0 -398
- package/lib/commonjs/components/AudioOutputSwitchView.js +0 -144
- package/lib/commonjs/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/commonjs/components/BrandingView.js +0 -78
- package/lib/commonjs/components/BrandingView.js.map +0 -1
- package/lib/commonjs/components/ChannelView.js +0 -117
- package/lib/commonjs/components/ChannelView.js.map +0 -1
- package/lib/commonjs/components/ErrorView.js +0 -88
- package/lib/commonjs/components/ErrorView.js.map +0 -1
- package/lib/commonjs/components/LiveVoiceView.js +0 -107
- package/lib/commonjs/components/LiveVoiceView.js.map +0 -1
- package/lib/commonjs/components/PlayButtonView.js +0 -161
- package/lib/commonjs/components/PlayButtonView.js.map +0 -1
- package/lib/commonjs/components/ReconnectingView.js +0 -109
- package/lib/commonjs/components/ReconnectingView.js.map +0 -1
- package/lib/commonjs/components/WarningView.js +0 -58
- package/lib/commonjs/components/WarningView.js.map +0 -1
- package/lib/commonjs/components/index.js +0 -94
- package/lib/commonjs/components/index.js.map +0 -1
- package/lib/commonjs/icons/branding.png +0 -0
- package/lib/commonjs/icons/cpu.png +0 -0
- package/lib/commonjs/icons/headphones.png +0 -0
- package/lib/commonjs/icons/mic.png +0 -0
- package/lib/commonjs/icons/pause.png +0 -0
- package/lib/commonjs/icons/play.png +0 -0
- package/lib/commonjs/icons/speaker.png +0 -0
- package/lib/commonjs/index.js +0 -327
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js +0 -19
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js.map +0 -1
- package/lib/commonjs/util/Colors.js +0 -30
- package/lib/commonjs/util/Colors.js.map +0 -1
- package/lib/commonjs/util/ForegroundServiceConfig.js +0 -33
- package/lib/commonjs/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/commonjs/util/PlayingState.js +0 -24
- package/lib/commonjs/util/PlayingState.js.map +0 -1
- package/lib/commonjs/util/Translations.js +0 -47
- package/lib/commonjs/util/Translations.js.map +0 -1
- package/lib/commonjs/util/UIState.js +0 -6
- package/lib/commonjs/util/UIState.js.map +0 -1
- package/lib/module/icons/pause.png +0 -0
- package/lib/module/icons/play.png +0 -0
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts +0 -6
- package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -149
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts +0 -48
- package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/UIState.d.ts +0 -45
- package/lib/typescript/commonjs/src/util/UIState.d.ts.map +0 -1
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/BrandingView.d.ts +0 -6
- package/lib/typescript/module/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ChannelView.d.ts +0 -13
- package/lib/typescript/module/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ErrorView.d.ts +0 -9
- package/lib/typescript/module/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts +0 -6
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/module/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReconnectingView.d.ts +0 -9
- package/lib/typescript/module/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/WarningView.d.ts +0 -8
- package/lib/typescript/module/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/index.d.ts +0 -9
- package/lib/typescript/module/src/components/index.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -149
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Colors.d.ts +0 -13
- package/lib/typescript/module/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/module/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/module/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Translations.d.ts +0 -22
- package/lib/typescript/module/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/module/src/util/UIState.d.ts +0 -45
- package/lib/typescript/module/src/util/UIState.d.ts.map +0 -1
- package/react-native.config.js +0 -12
- package/src/icons/pause.png +0 -0
- package/src/icons/play.png +0 -0
- /package/lib/{typescript/module → module}/package.json +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/AudioOutputSwitchView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/BrandingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ErrorView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReconnectingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/WarningView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/index.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/PlayingState.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/Translations.d.ts +0 -0
|
@@ -1,179 +1,374 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
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
|
+
import { COLORS } from "../util/Colors";
|
|
15
|
+
import {
|
|
16
|
+
ActivityIndicator,
|
|
17
|
+
Image,
|
|
18
|
+
TouchableOpacity,
|
|
19
|
+
useColorScheme,
|
|
20
|
+
View,
|
|
21
|
+
} from "react-native";
|
|
22
|
+
import { PlayingState } from "../util/PlayingState";
|
|
15
23
|
|
|
16
24
|
export interface PlayButtonProps {
|
|
17
25
|
playingState: PlayingState;
|
|
18
26
|
isChannelOnline: boolean;
|
|
27
|
+
hasAudio?: boolean;
|
|
28
|
+
hasSubtitles?: boolean;
|
|
19
29
|
isDarkMode?: boolean;
|
|
20
|
-
|
|
30
|
+
onAudioPress?: () => void;
|
|
31
|
+
onSubtitlesPress?: () => void;
|
|
32
|
+
onPress?: () => void;
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
const PlayButtonView: React.FC<PlayButtonProps> = ({
|
|
24
36
|
playingState,
|
|
25
37
|
isChannelOnline,
|
|
26
|
-
|
|
38
|
+
hasAudio = true,
|
|
39
|
+
hasSubtitles = false,
|
|
40
|
+
isDarkMode = useColorScheme() === "dark",
|
|
41
|
+
onAudioPress,
|
|
42
|
+
onSubtitlesPress,
|
|
27
43
|
onPress,
|
|
28
|
-
|
|
29
44
|
}) => {
|
|
30
45
|
const isPlaying = playingState === PlayingState.PLAYING;
|
|
31
46
|
const isTransitioning = playingState === PlayingState.TRANSITIONING;
|
|
32
47
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
const getAudioIconColor = () => {
|
|
49
|
+
if (!isChannelOnline) {
|
|
50
|
+
return isDarkMode ? "#5a5a60" : "#d1d1d6";
|
|
51
|
+
}
|
|
52
|
+
return COLORS.white;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const getSubtitlesIconColor = () => {
|
|
56
|
+
if (!isChannelOnline) {
|
|
57
|
+
return isDarkMode ? "#ffffff" : "#000000";
|
|
58
|
+
}
|
|
59
|
+
return COLORS.white;
|
|
60
|
+
};
|
|
38
61
|
|
|
39
|
-
const
|
|
62
|
+
const audioIconColor = getAudioIconColor();
|
|
63
|
+
const subtitlesIconColor = getSubtitlesIconColor();
|
|
40
64
|
|
|
41
|
-
const
|
|
65
|
+
const getAudioIcon = () => {
|
|
42
66
|
if (isTransitioning) {
|
|
43
|
-
return <ActivityIndicator size={20} color={
|
|
67
|
+
return <ActivityIndicator size={20} color={audioIconColor} style={{}} />;
|
|
44
68
|
}
|
|
45
69
|
return isPlaying ? (
|
|
46
70
|
<Image
|
|
47
|
-
source={require(
|
|
48
|
-
style={[{tintColor:
|
|
49
|
-
/>
|
|
71
|
+
source={require("../icons/pause.png")}
|
|
72
|
+
style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
|
|
73
|
+
/>
|
|
74
|
+
) : (
|
|
50
75
|
<Image
|
|
51
|
-
source={require(
|
|
52
|
-
style={[{tintColor:
|
|
76
|
+
source={require("../icons/play.png")}
|
|
77
|
+
style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getSubtitlesIcon = () => {
|
|
83
|
+
return (
|
|
84
|
+
<Image
|
|
85
|
+
source={require("../icons/captions.png")}
|
|
86
|
+
style={[{ tintColor: subtitlesIconColor, width: 30, height: 26 }]}
|
|
53
87
|
/>
|
|
54
88
|
);
|
|
55
89
|
};
|
|
56
90
|
|
|
57
91
|
const getStyleType = () => {
|
|
58
|
-
if (!isChannelOnline) return
|
|
59
|
-
if (isPlaying) return
|
|
60
|
-
return
|
|
92
|
+
if (!isChannelOnline) return "offline";
|
|
93
|
+
if (isPlaying) return "playing";
|
|
94
|
+
return "paused";
|
|
61
95
|
};
|
|
62
96
|
|
|
97
|
+
// If no audio and no subtitles, render disabled button with dashed border
|
|
98
|
+
if (!hasAudio && !hasSubtitles) {
|
|
99
|
+
const noContentStyle = {
|
|
100
|
+
...baseButtonStyleNoContent,
|
|
101
|
+
backgroundColor: isDarkMode ? "#1c1c1e00" : "#ffffff",
|
|
102
|
+
borderColor: isDarkMode
|
|
103
|
+
? COLORS_SCHEME.borderGrayDark
|
|
104
|
+
: COLORS_SCHEME.borderGrayLight,
|
|
105
|
+
borderStyle: "dashed" as const,
|
|
106
|
+
};
|
|
107
|
+
return (
|
|
108
|
+
<TouchableOpacity
|
|
109
|
+
style={noContentStyle}
|
|
110
|
+
disabled={true}
|
|
111
|
+
activeOpacity={0.8}
|
|
112
|
+
>
|
|
113
|
+
<View />
|
|
114
|
+
</TouchableOpacity>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// If only audio, render simple button
|
|
119
|
+
if (hasAudio && !hasSubtitles) {
|
|
120
|
+
return (
|
|
121
|
+
<TouchableOpacity
|
|
122
|
+
style={getButtonStyle(getStyleType(), isDarkMode, false)}
|
|
123
|
+
onPress={onAudioPress || onPress}
|
|
124
|
+
activeOpacity={0.8}
|
|
125
|
+
>
|
|
126
|
+
{getAudioIcon()}
|
|
127
|
+
</TouchableOpacity>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// If only subtitles, render subtitles button
|
|
132
|
+
if (!hasAudio && hasSubtitles) {
|
|
133
|
+
return (
|
|
134
|
+
<TouchableOpacity
|
|
135
|
+
style={getButtonStyle(getStyleType(), isDarkMode, false)}
|
|
136
|
+
onPress={onSubtitlesPress || onPress}
|
|
137
|
+
activeOpacity={0.8}
|
|
138
|
+
>
|
|
139
|
+
{getSubtitlesIcon()}
|
|
140
|
+
</TouchableOpacity>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// If both audio and subtitles, render split button
|
|
63
145
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
146
|
+
<View style={getSplitButtonContainerStyle(getStyleType(), isDarkMode)}>
|
|
147
|
+
<TouchableOpacity
|
|
148
|
+
style={getSplitButtonAudioStyle(getStyleType(), isDarkMode)}
|
|
149
|
+
onPress={onAudioPress || onPress}
|
|
150
|
+
activeOpacity={0.8}
|
|
151
|
+
>
|
|
152
|
+
{getAudioIcon()}
|
|
153
|
+
</TouchableOpacity>
|
|
154
|
+
<View style={getDividerStyle(getStyleType(), isDarkMode)} />
|
|
155
|
+
<TouchableOpacity
|
|
156
|
+
style={getSplitButtonSubtitlesStyle(getStyleType(), isDarkMode)}
|
|
157
|
+
onPress={onSubtitlesPress || onPress}
|
|
158
|
+
activeOpacity={0.8}
|
|
159
|
+
>
|
|
160
|
+
{getSubtitlesIcon()}
|
|
161
|
+
</TouchableOpacity>
|
|
162
|
+
</View>
|
|
71
163
|
);
|
|
72
164
|
};
|
|
73
165
|
|
|
74
|
-
type ButtonStyleType =
|
|
166
|
+
type ButtonStyleType = "paused" | "playing" | "offline";
|
|
75
167
|
|
|
76
168
|
export const getButtonStyle = (
|
|
77
169
|
type: ButtonStyleType,
|
|
78
|
-
isDarkMode: boolean
|
|
170
|
+
isDarkMode: boolean,
|
|
171
|
+
isSplit: boolean = false,
|
|
79
172
|
) => {
|
|
80
|
-
|
|
173
|
+
if (isSplit) {
|
|
174
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
|
|
175
|
+
}
|
|
176
|
+
return ButtonStyles[type][isDarkMode ? "dark" : "light"];
|
|
81
177
|
};
|
|
82
178
|
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
outlineStyle: 'solid' as const,
|
|
89
|
-
outlineWidth: 3,
|
|
179
|
+
export const getSplitButtonContainerStyle = (
|
|
180
|
+
type: ButtonStyleType,
|
|
181
|
+
isDarkMode: boolean,
|
|
182
|
+
) => {
|
|
183
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
|
|
90
184
|
};
|
|
91
185
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
186
|
+
export const getSplitButtonAudioStyle = (
|
|
187
|
+
type: ButtonStyleType,
|
|
188
|
+
isDarkMode: boolean,
|
|
189
|
+
) => {
|
|
190
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].audio;
|
|
191
|
+
};
|
|
96
192
|
|
|
97
|
-
|
|
193
|
+
export const getSplitButtonSubtitlesStyle = (
|
|
194
|
+
type: ButtonStyleType,
|
|
195
|
+
isDarkMode: boolean,
|
|
196
|
+
) => {
|
|
197
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].subtitles;
|
|
198
|
+
};
|
|
98
199
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
200
|
+
export const getDividerStyle = (type: ButtonStyleType, isDarkMode: boolean) => {
|
|
201
|
+
// When button is online (orange background), divider is light orange
|
|
202
|
+
if (type === "paused" || type === "playing") {
|
|
203
|
+
return {
|
|
204
|
+
width: 1,
|
|
205
|
+
height: 24,
|
|
206
|
+
backgroundColor: COLORS_SCHEME.dividerOnOrange,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
102
209
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
210
|
+
// When button is offline, divider is gray (same as border)
|
|
211
|
+
return {
|
|
212
|
+
width: 1,
|
|
213
|
+
height: 24,
|
|
214
|
+
backgroundColor: isDarkMode
|
|
215
|
+
? COLORS_SCHEME.borderGrayDark
|
|
216
|
+
: COLORS_SCHEME.borderGrayLight,
|
|
217
|
+
};
|
|
218
|
+
};
|
|
106
219
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
220
|
+
const baseButtonStyle = {
|
|
221
|
+
width: 96,
|
|
222
|
+
height: 44,
|
|
223
|
+
borderRadius: 22,
|
|
224
|
+
borderWidth: 1,
|
|
225
|
+
alignItems: "center" as const,
|
|
226
|
+
justifyContent: "center" as const,
|
|
111
227
|
};
|
|
112
228
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
229
|
+
const baseButtonStyleNoContent = {
|
|
230
|
+
width: 96,
|
|
231
|
+
height: 44,
|
|
232
|
+
borderRadius: 22,
|
|
233
|
+
borderWidth: 1,
|
|
234
|
+
alignItems: "center" as const,
|
|
235
|
+
justifyContent: "center" as const,
|
|
236
|
+
};
|
|
117
237
|
|
|
118
|
-
|
|
238
|
+
const baseSplitButtonStyle = {
|
|
239
|
+
width: 96,
|
|
240
|
+
height: 44,
|
|
241
|
+
borderRadius: 22,
|
|
242
|
+
borderWidth: 1,
|
|
243
|
+
flexDirection: "row" as const,
|
|
244
|
+
alignItems: "center" as const,
|
|
245
|
+
justifyContent: "center" as const,
|
|
246
|
+
overflow: "hidden" as const,
|
|
247
|
+
};
|
|
119
248
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
249
|
+
const baseSplitAudioStyle = {
|
|
250
|
+
flex: 1,
|
|
251
|
+
height: 44,
|
|
252
|
+
alignItems: "center" as const,
|
|
253
|
+
justifyContent: "center" as const,
|
|
254
|
+
};
|
|
123
255
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
256
|
+
const baseSplitSubtitlesStyle = {
|
|
257
|
+
flex: 1,
|
|
258
|
+
height: 44,
|
|
259
|
+
alignItems: "center" as const,
|
|
260
|
+
justifyContent: "center" as const,
|
|
261
|
+
};
|
|
127
262
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
263
|
+
const COLORS_SCHEME = {
|
|
264
|
+
orange: "#f56230",
|
|
265
|
+
dividerOnOrange: "#ffffff80",
|
|
266
|
+
borderGrayLight: "#d1d1d6",
|
|
267
|
+
borderGrayDark: "#5a5a60",
|
|
132
268
|
};
|
|
133
269
|
|
|
134
270
|
export const ButtonStyles = {
|
|
135
271
|
paused: {
|
|
136
272
|
light: {
|
|
137
273
|
...baseButtonStyle,
|
|
138
|
-
backgroundColor:
|
|
139
|
-
borderColor:
|
|
140
|
-
outlineColor: ButtonColorLight.playButtonBorderThickOnline,
|
|
274
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
275
|
+
borderColor: "transparent",
|
|
141
276
|
},
|
|
142
277
|
dark: {
|
|
143
278
|
...baseButtonStyle,
|
|
144
|
-
backgroundColor:
|
|
145
|
-
borderColor:
|
|
146
|
-
outlineColor: ButtonColorDark.playButtonBorderThickOnline,
|
|
279
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
280
|
+
borderColor: "transparent",
|
|
147
281
|
},
|
|
148
282
|
},
|
|
149
283
|
|
|
150
284
|
playing: {
|
|
151
285
|
light: {
|
|
152
286
|
...baseButtonStyle,
|
|
153
|
-
backgroundColor:
|
|
154
|
-
borderColor:
|
|
155
|
-
outlineColor: ButtonColorLight.playButtonBorderThickPlaying,
|
|
287
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
288
|
+
borderColor: "transparent",
|
|
156
289
|
},
|
|
157
290
|
dark: {
|
|
158
291
|
...baseButtonStyle,
|
|
159
|
-
backgroundColor:
|
|
160
|
-
borderColor:
|
|
161
|
-
outlineColor: ButtonColorDark.playButtonBorderThickPlaying,
|
|
292
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
293
|
+
borderColor: "transparent",
|
|
162
294
|
},
|
|
163
295
|
},
|
|
164
296
|
|
|
165
297
|
offline: {
|
|
166
298
|
light: {
|
|
167
299
|
...baseButtonStyle,
|
|
168
|
-
backgroundColor:
|
|
169
|
-
borderColor:
|
|
170
|
-
outlineColor: ButtonColorLight.playButtonBorderThickOffline,
|
|
300
|
+
backgroundColor: "#ffffff",
|
|
301
|
+
borderColor: COLORS_SCHEME.borderGrayLight,
|
|
171
302
|
},
|
|
172
303
|
dark: {
|
|
173
304
|
...baseButtonStyle,
|
|
174
|
-
backgroundColor:
|
|
175
|
-
borderColor:
|
|
176
|
-
|
|
305
|
+
backgroundColor: "#212429",
|
|
306
|
+
borderColor: COLORS_SCHEME.borderGrayDark,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export const SplitButtonStyles = {
|
|
312
|
+
paused: {
|
|
313
|
+
light: {
|
|
314
|
+
container: {
|
|
315
|
+
...baseSplitButtonStyle,
|
|
316
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
317
|
+
borderColor: "transparent",
|
|
318
|
+
},
|
|
319
|
+
audio: baseSplitAudioStyle,
|
|
320
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
321
|
+
},
|
|
322
|
+
dark: {
|
|
323
|
+
container: {
|
|
324
|
+
...baseSplitButtonStyle,
|
|
325
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
326
|
+
borderColor: "transparent",
|
|
327
|
+
},
|
|
328
|
+
audio: baseSplitAudioStyle,
|
|
329
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
playing: {
|
|
334
|
+
light: {
|
|
335
|
+
container: {
|
|
336
|
+
...baseSplitButtonStyle,
|
|
337
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
338
|
+
borderColor: "transparent",
|
|
339
|
+
},
|
|
340
|
+
audio: baseSplitAudioStyle,
|
|
341
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
342
|
+
},
|
|
343
|
+
dark: {
|
|
344
|
+
container: {
|
|
345
|
+
...baseSplitButtonStyle,
|
|
346
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
347
|
+
borderColor: "transparent",
|
|
348
|
+
},
|
|
349
|
+
audio: baseSplitAudioStyle,
|
|
350
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
offline: {
|
|
355
|
+
light: {
|
|
356
|
+
container: {
|
|
357
|
+
...baseSplitButtonStyle,
|
|
358
|
+
backgroundColor: "#ffffff",
|
|
359
|
+
borderColor: COLORS_SCHEME.borderGrayLight,
|
|
360
|
+
},
|
|
361
|
+
audio: baseSplitAudioStyle,
|
|
362
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
363
|
+
},
|
|
364
|
+
dark: {
|
|
365
|
+
container: {
|
|
366
|
+
...baseSplitButtonStyle,
|
|
367
|
+
backgroundColor: "#212429",
|
|
368
|
+
borderColor: COLORS_SCHEME.borderGrayDark,
|
|
369
|
+
},
|
|
370
|
+
audio: baseSplitAudioStyle,
|
|
371
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
177
372
|
},
|
|
178
373
|
},
|
|
179
374
|
};
|
|
@@ -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, { useEffect } from 'react';
|
|
13
15
|
import { View, Text, useColorScheme, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
|
|
@@ -32,12 +34,10 @@ export const ReconnectingView: React.FC<ReconnectingProps> = (props) => {
|
|
|
32
34
|
//updated the countdown every second!
|
|
33
35
|
useEffect(() => {
|
|
34
36
|
const newValue = calculateSecondsUntilRetry(reconnectingState)
|
|
35
|
-
console.log('Updated seconds' + newValue)
|
|
36
37
|
setSecUntilRetry(newValue);
|
|
37
38
|
|
|
38
39
|
const interval = setInterval(() => {
|
|
39
40
|
const newValue = calculateSecondsUntilRetry(reconnectingState)
|
|
40
|
-
console.log('Updated seconds' + newValue)
|
|
41
41
|
setSecUntilRetry(newValue);
|
|
42
42
|
}, 1000);
|
|
43
43
|
|
|
@@ -92,7 +92,14 @@ export const ReconnectingView: React.FC<ReconnectingProps> = (props) => {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
function calculateSecondsUntilRetry(reconnectingState: Reconnecting): number {
|
|
95
|
-
|
|
95
|
+
if (reconnectingState.state.type !== 'awaitingRetry') {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return Math.max(
|
|
100
|
+
0,
|
|
101
|
+
(reconnectingState.state.retryAt.getTime() / 1000) - (Date.now() / 1000),
|
|
102
|
+
);
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
const styles = StyleSheet.create({
|
|
@@ -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';
|
package/src/components/index.tsx
CHANGED
|
@@ -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
|
export * from './AudioOutputSwitchView';
|
|
13
15
|
export * from './BrandingView';
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|