agora-appbuilder-core 1.0.8 → 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/package.json +5 -2
- package/template/_package-lock.json +22850 -0
- package/template/agora-rn-uikit/.git/HEAD +1 -0
- package/template/agora-rn-uikit/.git/config +16 -0
- package/template/agora-rn-uikit/.git/description +1 -0
- package/template/agora-rn-uikit/.git/hooks/applypatch-msg.sample +15 -0
- package/template/agora-rn-uikit/.git/hooks/commit-msg.sample +24 -0
- package/template/agora-rn-uikit/.git/hooks/fsmonitor-watchman.sample +173 -0
- package/template/agora-rn-uikit/.git/hooks/post-update.sample +8 -0
- package/template/agora-rn-uikit/.git/hooks/pre-applypatch.sample +14 -0
- package/template/agora-rn-uikit/.git/hooks/pre-commit.sample +49 -0
- package/template/agora-rn-uikit/.git/hooks/pre-merge-commit.sample +13 -0
- package/template/agora-rn-uikit/.git/hooks/pre-push.sample +53 -0
- package/template/agora-rn-uikit/.git/hooks/pre-rebase.sample +169 -0
- package/template/agora-rn-uikit/.git/hooks/pre-receive.sample +24 -0
- package/template/agora-rn-uikit/.git/hooks/prepare-commit-msg.sample +42 -0
- package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +78 -0
- package/template/agora-rn-uikit/.git/hooks/update.sample +128 -0
- package/template/agora-rn-uikit/.git/index +0 -0
- package/template/agora-rn-uikit/.git/info/exclude +6 -0
- package/template/agora-rn-uikit/.git/logs/HEAD +2 -0
- package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -0
- package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -0
- package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.pack +0 -0
- package/template/agora-rn-uikit/.git/packed-refs +12 -0
- package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -0
- package/template/agora-rn-uikit/.git/refs/heads/master +1 -0
- package/template/agora-rn-uikit/.git/refs/remotes/origin/HEAD +1 -0
- package/template/agora-rn-uikit/.gitignore +63 -0
- package/template/agora-rn-uikit/package-lock.json +7612 -0
- package/template/agora-rn-uikit/package.json +1 -0
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +8 -8
- package/template/agora-rn-uikit/src/{LocalUserContext.tsx → Contexts/LocalUserContext.tsx} +1 -1
- package/template/agora-rn-uikit/src/{MaxUidContext.tsx → Contexts/MaxUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MinUidContext.tsx → Contexts/MinUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{PropsContext.tsx → Contexts/PropsContext.tsx} +34 -16
- package/template/agora-rn-uikit/src/{RtcContext.tsx → Contexts/RtcContext.tsx} +12 -21
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +25 -15
- package/template/agora-rn-uikit/src/Controls/Icons.ts +53 -3
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +53 -0
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -3
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +58 -14
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +60 -14
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/Screenshare.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +9 -9
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +20 -17
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +8 -8
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +13 -8
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +1 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +46 -0
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +47 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +21 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +9 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +138 -0
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +100 -0
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +197 -0
- package/template/agora-rn-uikit/src/Style.ts +3 -3
- package/template/agora-rn-uikit/src/Utils/actionTypeGuard.tsx +9 -0
- package/template/agora-rn-uikit/src/{events.ts → Utils/events.ts} +0 -0
- package/template/agora-rn-uikit/src/{permission.ts → Utils/permission.ts} +0 -0
- package/template/agora-rn-uikit/src/{quality.tsx → Utils/quality.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MaxVideoView.native.tsx → Views/MaxVideoView.native.tsx} +3 -4
- package/template/agora-rn-uikit/src/{MaxVideoView.tsx → Views/MaxVideoView.tsx} +3 -4
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +86 -0
- package/template/agora-rn-uikit/src/index.ts +67 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +23 -6
- package/template/package-lock.json +22850 -0
- package/template/package.json +6 -4
- package/template/react-native-toast-message/.gitignore +5 -0
- package/template/react-native-toast-message/.npmignore +5 -0
- package/template/react-native-toast-message/package-lock.json +10553 -0
- package/template/src/.DS_Store +0 -0
- package/template/src/assets/icons.ts +35 -6
- package/template/src/atoms/SecondaryButton.tsx +6 -5
- package/template/src/atoms/TextInput.tsx +6 -1
- package/template/src/components/Chat.tsx +50 -21
- package/template/src/components/ChatContext.ts +22 -1
- package/template/src/components/Controls.native.tsx +2 -2
- package/template/src/components/Controls.tsx +2 -2
- package/template/src/components/DeviceConfigure.tsx +1 -1
- package/template/src/components/GridVideo.tsx +69 -31
- package/template/src/components/Navbar.tsx +136 -113
- package/template/src/components/NetworkQualityContext.tsx +134 -0
- package/template/src/components/ParticipantsView.tsx +105 -49
- package/template/src/components/PinnedVideo.tsx +112 -71
- package/template/src/components/Precall.native.tsx +42 -23
- package/template/src/components/Precall.tsx +56 -51
- package/template/src/components/RTMConfigure.tsx +331 -181
- package/template/src/components/RTMEvents.tsx +84 -0
- package/template/src/components/Settings.tsx +19 -16
- package/template/src/components/Share.tsx +131 -62
- package/template/src/components/StorageContext.tsx +2 -0
- package/template/src/hooks/useImageDelay.tsx +28 -0
- package/template/src/pages/Authenticate.tsx +5 -4
- package/template/src/pages/Create.tsx +26 -16
- package/template/src/pages/Join.tsx +13 -30
- package/template/src/pages/VideoCall.tsx +181 -137
- package/template/src/subComponents/.DS_Store +0 -0
- package/template/src/subComponents/ChatContainer.tsx +40 -28
- package/template/src/subComponents/CopyJoinInfo.tsx +9 -12
- package/template/src/subComponents/LocalAudioMute.tsx +9 -9
- package/template/src/subComponents/LocalVideoMute.tsx +9 -9
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +161 -0
- package/template/src/subComponents/Recording.tsx +12 -16
- package/template/src/subComponents/RemoteAudioMute.tsx +23 -27
- package/template/src/subComponents/RemoteEndCall.tsx +7 -15
- package/template/src/subComponents/RemoteVideoMute.tsx +15 -28
- package/template/src/subComponents/ScreenShareNotice.tsx +61 -0
- package/template/src/subComponents/ScreenshareButton.tsx +76 -75
- package/template/src/subComponents/SelectOAuth.tsx +25 -12
- package/template/src/subComponents/SwitchCamera.tsx +5 -2
- package/template/src/subComponents/TextWithTooltip.native.tsx +128 -0
- package/template/src/subComponents/TextWithTooltip.tsx +44 -0
- package/template/src/subComponents/toastConfig.tsx +2 -2
- package/template/src/utils/hasBrandLogo.tsx +3 -0
- package/template/src/utils/isSafariBrowser.tsx +22 -0
- package/template/webpack.commons.js +1 -0
- package/template/agora-rn-uikit/Components.js +0 -35
- package/template/agora-rn-uikit/Contexts.js +0 -7
- package/template/agora-rn-uikit/index.js +0 -12
- package/template/agora-rn-uikit/src/MinVideoView.tsx +0 -87
- package/template/agora-rn-uikit/src/RTCConfigure.tsx +0 -516
|
@@ -1,27 +1,71 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext from '../../PropsContext';
|
|
3
|
-
import RtcContext
|
|
2
|
+
import PropsContext, {ToggleState} from '../../Contexts/PropsContext';
|
|
3
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
4
4
|
import BtnTemplate from '../BtnTemplate';
|
|
5
5
|
import styles from '../../Style';
|
|
6
|
-
import {LocalContext} from '../../LocalUserContext';
|
|
6
|
+
import {LocalContext} from '../../Contexts/LocalUserContext';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface Props {
|
|
9
|
+
btnText?: string;
|
|
10
|
+
variant?: 'outlined' | 'text';
|
|
11
|
+
}
|
|
12
|
+
function LocalAudioMute(props: Props) {
|
|
13
|
+
const {btnText = 'Audio', variant = 'Outlined'} = props;
|
|
9
14
|
const {styleProps} = useContext(PropsContext);
|
|
10
|
-
const {localBtnStyles} = styleProps || {};
|
|
15
|
+
const {localBtnStyles, remoteBtnStyles} = styleProps || {};
|
|
11
16
|
const {muteLocalAudio} = localBtnStyles || {};
|
|
12
|
-
const {
|
|
17
|
+
const {muteRemoteAudio} = remoteBtnStyles || {};
|
|
18
|
+
const {RtcEngine, dispatch} = useContext(RtcContext);
|
|
13
19
|
const local = useContext(LocalContext);
|
|
14
20
|
|
|
15
21
|
return (
|
|
16
22
|
<BtnTemplate
|
|
17
|
-
name={local.audio ? 'mic' : 'micOff'}
|
|
18
|
-
btnText={
|
|
19
|
-
style={{
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
name={local.audio === ToggleState.enabled ? 'mic' : 'micOff'}
|
|
24
|
+
btnText={btnText}
|
|
25
|
+
style={{
|
|
26
|
+
...styles.localBtn,
|
|
27
|
+
...(variant === 'Outlined'
|
|
28
|
+
? (muteLocalAudio as object)
|
|
29
|
+
: (muteRemoteAudio as object)),
|
|
30
|
+
}}
|
|
31
|
+
onPress={async () => {
|
|
32
|
+
const localState = local.audio;
|
|
33
|
+
// Don't do anything if it is in a transitional state
|
|
34
|
+
if (
|
|
35
|
+
localState === ToggleState.enabled ||
|
|
36
|
+
localState === ToggleState.disabled
|
|
37
|
+
) {
|
|
38
|
+
// Disable UI
|
|
39
|
+
dispatch({
|
|
40
|
+
type: 'LocalMuteAudio',
|
|
41
|
+
value: [
|
|
42
|
+
localState === ToggleState.enabled
|
|
43
|
+
? ToggleState.disabling
|
|
44
|
+
: ToggleState.enabling,
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
await RtcEngine.muteLocalAudioStream(
|
|
50
|
+
localState === ToggleState.enabled,
|
|
51
|
+
);
|
|
52
|
+
// Enable UI
|
|
53
|
+
dispatch({
|
|
54
|
+
type: 'LocalMuteAudio',
|
|
55
|
+
value: [
|
|
56
|
+
localState === ToggleState.enabled
|
|
57
|
+
? ToggleState.disabled
|
|
58
|
+
: ToggleState.enabled,
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.error(e);
|
|
63
|
+
dispatch({
|
|
64
|
+
type: 'LocalMuteAudio',
|
|
65
|
+
value: [localState],
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
25
69
|
}}
|
|
26
70
|
/>
|
|
27
71
|
);
|
|
@@ -1,27 +1,73 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext from '../../PropsContext';
|
|
3
|
-
import RtcContext
|
|
2
|
+
import PropsContext, {ToggleState} from '../../Contexts/PropsContext';
|
|
3
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
4
4
|
import BtnTemplate from '../BtnTemplate';
|
|
5
5
|
import styles from '../../Style';
|
|
6
|
-
import {LocalContext} from '../../LocalUserContext';
|
|
6
|
+
import {LocalContext} from '../../Contexts/LocalUserContext';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface Props {
|
|
9
|
+
btnText?: string;
|
|
10
|
+
variant?: 'outlined' | 'text';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function LocalVideoMute(props: Props) {
|
|
14
|
+
const {btnText = 'Video', variant = 'Outlined'} = props;
|
|
9
15
|
const {styleProps} = useContext(PropsContext);
|
|
10
|
-
const {localBtnStyles} = styleProps || {};
|
|
16
|
+
const {localBtnStyles, remoteBtnStyles} = styleProps || {};
|
|
11
17
|
const {muteLocalVideo} = localBtnStyles || {};
|
|
12
|
-
const {
|
|
18
|
+
const {muteRemoteVideo} = remoteBtnStyles || {};
|
|
19
|
+
const {RtcEngine, dispatch} = useContext(RtcContext);
|
|
13
20
|
const local = useContext(LocalContext);
|
|
14
21
|
|
|
15
22
|
return (
|
|
16
23
|
<BtnTemplate
|
|
17
|
-
name={local.video ? 'videocam' : 'videocamOff'}
|
|
18
|
-
btnText={
|
|
19
|
-
style={{
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
name={local.video === ToggleState.enabled ? 'videocam' : 'videocamOff'}
|
|
25
|
+
btnText={btnText}
|
|
26
|
+
style={{
|
|
27
|
+
...styles.localBtn,
|
|
28
|
+
...(variant === 'Outlined'
|
|
29
|
+
? (muteLocalVideo as object)
|
|
30
|
+
: (muteRemoteVideo as object)),
|
|
31
|
+
}}
|
|
32
|
+
onPress={async () => {
|
|
33
|
+
const localState = local.video;
|
|
34
|
+
// Don't do anything if it is in a transitional state
|
|
35
|
+
if (
|
|
36
|
+
localState === ToggleState.enabled ||
|
|
37
|
+
localState === ToggleState.disabled
|
|
38
|
+
) {
|
|
39
|
+
// Disable UI
|
|
40
|
+
dispatch({
|
|
41
|
+
type: 'LocalMuteVideo',
|
|
42
|
+
value: [
|
|
43
|
+
localState === ToggleState.enabled
|
|
44
|
+
? ToggleState.disabling
|
|
45
|
+
: ToggleState.enabling,
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await RtcEngine.muteLocalVideoStream(
|
|
51
|
+
localState === ToggleState.enabled ? true : false,
|
|
52
|
+
);
|
|
53
|
+
console.log('muted video', localState);
|
|
54
|
+
// Enable UI
|
|
55
|
+
dispatch({
|
|
56
|
+
type: 'LocalMuteVideo',
|
|
57
|
+
value: [
|
|
58
|
+
localState === ToggleState.enabled
|
|
59
|
+
? ToggleState.disabled
|
|
60
|
+
: ToggleState.enabled,
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
} catch (e) {
|
|
64
|
+
console.log('error while dispatching');
|
|
65
|
+
dispatch({
|
|
66
|
+
type: 'LocalMuteVideo',
|
|
67
|
+
value: [localState],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
25
71
|
}}
|
|
26
72
|
/>
|
|
27
73
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext from '../../PropsContext';
|
|
3
|
-
import RtcContext, {DispatchType} from '../../RtcContext';
|
|
2
|
+
import PropsContext from '../../Contexts/PropsContext';
|
|
3
|
+
import RtcContext, {DispatchType} from '../../Contexts/RtcContext';
|
|
4
4
|
import BtnTemplate from '../BtnTemplate';
|
|
5
5
|
import styles from '../../Style';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext from '../../PropsContext';
|
|
3
|
-
import RtcContext, {DispatchType} from '../../RtcContext';
|
|
2
|
+
import PropsContext from '../../Contexts/PropsContext';
|
|
3
|
+
import RtcContext, {DispatchType} from '../../Contexts/RtcContext';
|
|
4
4
|
import BtnTemplate from '../BtnTemplate';
|
|
5
5
|
import styles from '../../Style';
|
|
6
6
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext from '../../PropsContext';
|
|
3
|
-
import
|
|
2
|
+
import PropsContext,{ToggleState} from '../../Contexts/PropsContext';
|
|
3
|
+
import {LocalContext} from '../../Contexts/LocalUserContext';
|
|
4
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
4
5
|
import BtnTemplate from '../BtnTemplate';
|
|
5
6
|
import styles from '../../Style';
|
|
6
7
|
|
|
7
8
|
function SwitchCamera() {
|
|
8
|
-
const {styleProps} = useContext(PropsContext);
|
|
9
|
+
const {styleProps, callbacks} = useContext(PropsContext);
|
|
9
10
|
const {localBtnStyles} = styleProps || {};
|
|
10
11
|
const {switchCamera} = localBtnStyles || {};
|
|
11
|
-
const {
|
|
12
|
+
const {RtcEngine} = useContext(RtcContext);
|
|
13
|
+
const local = useContext(LocalContext);
|
|
12
14
|
return (
|
|
13
15
|
<BtnTemplate
|
|
14
16
|
name={'switchCamera'}
|
|
15
17
|
style={{...styles.localBtn, ...(switchCamera as object)}}
|
|
16
18
|
btnText={'Switch'}
|
|
19
|
+
disabled={local.video === ToggleState.enabled ? false : true}
|
|
17
20
|
onPress={() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: 'SwitchCamera',
|
|
21
|
-
value: [],
|
|
22
|
-
});
|
|
21
|
+
RtcEngine.switchCamera();
|
|
22
|
+
callbacks?.SwitchCamera && callbacks.SwitchCamera();
|
|
23
23
|
}}
|
|
24
24
|
/>
|
|
25
25
|
);
|
|
@@ -5,13 +5,16 @@ import EndCall from './Local/EndCall';
|
|
|
5
5
|
import LocalAudioMute from './Local/LocalAudioMute';
|
|
6
6
|
import LocalVideoMute from './Local/LocalVideoMute';
|
|
7
7
|
import SwitchCamera from './Local/SwitchCamera';
|
|
8
|
-
import FullScreen from './Local/FullScreen';
|
|
9
8
|
import RemoteControls from './RemoteControls';
|
|
10
|
-
import {MaxUidConsumer} from '../MaxUidContext';
|
|
11
|
-
import PropsContext from '../PropsContext';
|
|
12
|
-
import LocalUserContextComponent from '../LocalUserContext';
|
|
9
|
+
import {MaxUidConsumer} from '../Contexts/MaxUidContext';
|
|
10
|
+
import PropsContext from '../Contexts/PropsContext';
|
|
11
|
+
import LocalUserContextComponent from '../Contexts/LocalUserContext';
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
interface ControlsPropsInterface {
|
|
14
|
+
showButton?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Controls(props: ControlsPropsInterface) {
|
|
15
18
|
const {styleProps} = useContext(PropsContext);
|
|
16
19
|
const {localBtnContainer} = styleProps || {};
|
|
17
20
|
const showButton = props.showButton !== undefined ? props.showButton : true;
|
|
@@ -20,20 +23,20 @@ function Controls(props) {
|
|
|
20
23
|
<View style={{...styles.Controls, ...(localBtnContainer as object)}}>
|
|
21
24
|
<LocalAudioMute />
|
|
22
25
|
<LocalVideoMute />
|
|
23
|
-
<EndCall />
|
|
24
26
|
<SwitchCamera />
|
|
25
|
-
<
|
|
27
|
+
<EndCall />
|
|
26
28
|
</View>
|
|
27
|
-
{showButton ?
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
style={{...styles.Controls,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
:
|
|
36
|
-
|
|
29
|
+
{showButton ? (
|
|
30
|
+
<MaxUidConsumer>
|
|
31
|
+
{(users) => (
|
|
32
|
+
<View style={{...styles.Controls, top: styles.Controls.top - 100}}>
|
|
33
|
+
<RemoteControls user={users[0]} showRemoteSwap={false} />
|
|
34
|
+
</View>
|
|
35
|
+
)}
|
|
36
|
+
</MaxUidConsumer>
|
|
37
|
+
) : (
|
|
38
|
+
<></>
|
|
39
|
+
)}
|
|
37
40
|
</LocalUserContextComponent>
|
|
38
41
|
);
|
|
39
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import RtcContext
|
|
2
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
3
3
|
import BtnTemplate from '../BtnTemplate';
|
|
4
4
|
import styles from '../../Style';
|
|
5
|
-
import PropsContext from '../../PropsContext';
|
|
5
|
+
import PropsContext, {ToggleState, UidInterface} from '../../Contexts/PropsContext';
|
|
6
6
|
|
|
7
7
|
interface RemoteAudioMuteInterface {
|
|
8
8
|
user: UidInterface;
|
|
@@ -16,17 +16,17 @@ const RemoteAudioMute: React.FC<RemoteAudioMuteInterface> = (props) => {
|
|
|
16
16
|
|
|
17
17
|
return props.user.uid !== 'local' ? (
|
|
18
18
|
<BtnTemplate
|
|
19
|
-
name={props.user.audio ? 'mic' : 'micOff'}
|
|
19
|
+
name={props.user.audio === ToggleState.enabled ? 'mic' : 'micOff'}
|
|
20
20
|
style={{...styles.leftRemoteBtn, ...(muteRemoteAudio as object)}}
|
|
21
21
|
onPress={() => {
|
|
22
22
|
RtcEngine.muteRemoteAudioStream(
|
|
23
23
|
props.user.uid as number,
|
|
24
|
-
props.user.audio,
|
|
24
|
+
props.user.audio === ToggleState.enabled,
|
|
25
25
|
);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
26
|
+
// dispatch({
|
|
27
|
+
// type: 'UserMuteRemoteAudio',
|
|
28
|
+
// value: [props.user, props.user.audio],
|
|
29
|
+
// });
|
|
30
30
|
}}
|
|
31
31
|
/>
|
|
32
32
|
) : (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import RtcContext
|
|
2
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
3
3
|
import BtnTemplate from '../BtnTemplate';
|
|
4
4
|
import styles from '../../Style';
|
|
5
|
-
import PropsContext from '../../PropsContext';
|
|
5
|
+
import PropsContext, {UidInterface} from '../../Contexts/PropsContext';
|
|
6
6
|
|
|
7
7
|
interface RemoteSwapInterface {
|
|
8
8
|
user: UidInterface;
|
|
@@ -23,7 +23,7 @@ const RemoteSwap: React.FC<RemoteSwapInterface> = (props) => {
|
|
|
23
23
|
: {}
|
|
24
24
|
}
|
|
25
25
|
onPress={() => {
|
|
26
|
-
|
|
26
|
+
dispatch({
|
|
27
27
|
type: 'SwapVideo',
|
|
28
28
|
value: [props.user],
|
|
29
29
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext
|
|
3
|
-
|
|
2
|
+
import PropsContext, {
|
|
3
|
+
ToggleState,
|
|
4
|
+
UidInterface,
|
|
5
|
+
} from '../../Contexts/PropsContext';
|
|
6
|
+
import RtcContext from '../../Contexts/RtcContext';
|
|
4
7
|
import styles from '../../Style';
|
|
5
8
|
import BtnTemplate from '../BtnTemplate';
|
|
6
9
|
|
|
@@ -17,7 +20,9 @@ const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
|
|
|
17
20
|
|
|
18
21
|
return props.user.uid !== 'local' ? (
|
|
19
22
|
<BtnTemplate
|
|
20
|
-
name={
|
|
23
|
+
name={
|
|
24
|
+
props.user.video === ToggleState.enabled ? 'videocam' : 'videocamOff'
|
|
25
|
+
}
|
|
21
26
|
style={
|
|
22
27
|
props.rightButton
|
|
23
28
|
? {...styles.rightRemoteBtn, ...(muteRemoteVideo as object)}
|
|
@@ -26,12 +31,12 @@ const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
|
|
|
26
31
|
onPress={() => {
|
|
27
32
|
RtcEngine.muteRemoteVideoStream(
|
|
28
33
|
props.user.uid as number,
|
|
29
|
-
props.user.video,
|
|
34
|
+
props.user.video === ToggleState.enabled, //If enabled, disable or vice-versa
|
|
30
35
|
);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
36
|
+
// dispatch({
|
|
37
|
+
// type: 'UserMuteRemoteVideo',
|
|
38
|
+
// value: [props.user, props.user.video],
|
|
39
|
+
// });
|
|
35
40
|
}}
|
|
36
41
|
/>
|
|
37
42
|
) : (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
|
-
import PropsContext from '../PropsContext';
|
|
4
|
-
import {UidInterface} from '../RtcContext';
|
|
3
|
+
import PropsContext, {UidInterface} from '../Contexts/PropsContext';
|
|
5
4
|
import styles from '../Style';
|
|
6
5
|
import RemoteAudioMute from './Remote/RemoteAudioMute';
|
|
7
6
|
import RemoteSwap from './Remote/RemoteSwap';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function LocalMuteAudio(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'LocalMuteAudio'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
const LocalAudioMute = (user: UidInterface) => {
|
|
10
|
+
if (user.uid === 'local') {
|
|
11
|
+
user.audio = action.value[0];
|
|
12
|
+
}
|
|
13
|
+
return user;
|
|
14
|
+
};
|
|
15
|
+
stateUpdate = {
|
|
16
|
+
min: state.min.map(LocalAudioMute),
|
|
17
|
+
max: state.max.map(LocalAudioMute),
|
|
18
|
+
};
|
|
19
|
+
return stateUpdate;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function LocalMuteVideo(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'LocalMuteVideo'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
const LocalVideoMute = (user: UidInterface) => {
|
|
10
|
+
if (user.uid === 'local') {
|
|
11
|
+
user.video = action.value[0];
|
|
12
|
+
}
|
|
13
|
+
return user;
|
|
14
|
+
};
|
|
15
|
+
stateUpdate = {
|
|
16
|
+
min: state.min.map(LocalVideoMute),
|
|
17
|
+
max: state.max.map(LocalVideoMute),
|
|
18
|
+
};
|
|
19
|
+
return stateUpdate;
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {ToggleState, UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function RemoteAudioStateChanged(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'RemoteAudioStateChanged'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
let audioState: ToggleState;
|
|
10
|
+
if (action.value[1] === 2 || action.value[1] === 1) {
|
|
11
|
+
audioState = ToggleState.enabled;
|
|
12
|
+
} else {
|
|
13
|
+
audioState = ToggleState.disabled;
|
|
14
|
+
}
|
|
15
|
+
const audioChange = (user: UidInterface) => {
|
|
16
|
+
if (user.uid === action.value[0]) {
|
|
17
|
+
user.audio = audioState;
|
|
18
|
+
}
|
|
19
|
+
return user;
|
|
20
|
+
};
|
|
21
|
+
stateUpdate = {
|
|
22
|
+
min: state.min.map(audioChange),
|
|
23
|
+
max: state.max.map(audioChange),
|
|
24
|
+
};
|
|
25
|
+
return stateUpdate;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {ToggleState, UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function RemoteVideoStateChanged(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'RemoteVideoStateChanged'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
let videoState: ToggleState;
|
|
10
|
+
if (action.value[1] === 0) {
|
|
11
|
+
videoState = ToggleState.disabled;
|
|
12
|
+
} else if (action.value[1] === 2) {
|
|
13
|
+
videoState = ToggleState.enabled;
|
|
14
|
+
}
|
|
15
|
+
const videoChange = (user: UidInterface) => {
|
|
16
|
+
if (user.uid === action.value[0] && videoState !== undefined) {
|
|
17
|
+
user.video = videoState;
|
|
18
|
+
}
|
|
19
|
+
return user;
|
|
20
|
+
};
|
|
21
|
+
stateUpdate = {
|
|
22
|
+
min: state.min.map(videoChange),
|
|
23
|
+
max: state.max.map(videoChange),
|
|
24
|
+
};
|
|
25
|
+
return stateUpdate;
|
|
26
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {DualStreamMode, UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function UpdateDualStreamMode(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'UpdateDualStreamMode'>,
|
|
7
|
+
) {
|
|
8
|
+
const newMode = action.value[0];
|
|
9
|
+
let stateUpdate: UidStateInterface;
|
|
10
|
+
if (newMode === DualStreamMode.HIGH) {
|
|
11
|
+
// Update everybody to high
|
|
12
|
+
const maxStateUpdate: UidInterface[] = state.max.map((user) => ({
|
|
13
|
+
...user,
|
|
14
|
+
streamType: 'high',
|
|
15
|
+
}));
|
|
16
|
+
const minStateUpdate: UidInterface[] = state.min.map((user) => ({
|
|
17
|
+
...user,
|
|
18
|
+
streamType: 'high',
|
|
19
|
+
}));
|
|
20
|
+
stateUpdate = {min: minStateUpdate, max: maxStateUpdate};
|
|
21
|
+
} else if (newMode === DualStreamMode.LOW) {
|
|
22
|
+
// Update everybody to low
|
|
23
|
+
const maxStateUpdate: UidInterface[] = state.max.map((user) => ({
|
|
24
|
+
...user,
|
|
25
|
+
streamType: 'low',
|
|
26
|
+
}));
|
|
27
|
+
const minStateUpdate: UidInterface[] = state.min.map((user) => ({
|
|
28
|
+
...user,
|
|
29
|
+
streamType: 'low',
|
|
30
|
+
}));
|
|
31
|
+
stateUpdate = {min: minStateUpdate, max: maxStateUpdate};
|
|
32
|
+
} else {
|
|
33
|
+
// if (newMode === DualStreamMode.DYNAMIC)
|
|
34
|
+
// Max users are high other are low
|
|
35
|
+
const maxStateUpdate: UidInterface[] = state.max.map((user) => ({
|
|
36
|
+
...user,
|
|
37
|
+
streamType: 'high',
|
|
38
|
+
}));
|
|
39
|
+
const minStateUpdate: UidInterface[] = state.min.map((user) => ({
|
|
40
|
+
...user,
|
|
41
|
+
streamType: 'low',
|
|
42
|
+
}));
|
|
43
|
+
stateUpdate = {min: minStateUpdate, max: maxStateUpdate};
|
|
44
|
+
}
|
|
45
|
+
return stateUpdate;
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {DualStreamMode, ToggleState} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function UserJoined(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'UserJoined'>,
|
|
7
|
+
dualStreamMode: DualStreamMode,
|
|
8
|
+
uids: (string | number)[],
|
|
9
|
+
) {
|
|
10
|
+
let stateUpdate = {};
|
|
11
|
+
if (uids.indexOf(action.value[0]) === -1) {
|
|
12
|
+
//If new user has joined
|
|
13
|
+
//By default add to minimized
|
|
14
|
+
let minUpdate = [
|
|
15
|
+
...state.min,
|
|
16
|
+
{
|
|
17
|
+
uid: action.value[0],
|
|
18
|
+
audio: ToggleState.disabled,
|
|
19
|
+
video: ToggleState.disabled,
|
|
20
|
+
streamType: dualStreamMode === DualStreamMode.HIGH ? 'high' : 'low', // Low if DualStreamMode is LOW or DYNAMIC by default
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
if (minUpdate.length === 1 && state.max[0].uid === 'local') {
|
|
25
|
+
//Only one remote and local is maximized
|
|
26
|
+
//Change stream type to high if dualStreaMode is DYNAMIC
|
|
27
|
+
if (dualStreamMode === DualStreamMode.DYNAMIC) {
|
|
28
|
+
minUpdate[0].streamType = 'high';
|
|
29
|
+
}
|
|
30
|
+
//Swap max and min
|
|
31
|
+
stateUpdate = {
|
|
32
|
+
max: minUpdate,
|
|
33
|
+
min: state.max,
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
//More than one remote
|
|
37
|
+
stateUpdate = {
|
|
38
|
+
min: minUpdate,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('new user joined!\n', state, stateUpdate, {
|
|
43
|
+
dualStreamMode,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return stateUpdate;
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function UserMuteRemoteAudio(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'UserMuteRemoteAudio'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
const audioMute = (user: UidInterface) => {
|
|
10
|
+
if (user.uid === action.value[0].uid) {
|
|
11
|
+
user.audio = action.value[1];
|
|
12
|
+
}
|
|
13
|
+
return user;
|
|
14
|
+
};
|
|
15
|
+
stateUpdate = {
|
|
16
|
+
min: state.min.map(audioMute),
|
|
17
|
+
max: state.max.map(audioMute),
|
|
18
|
+
};
|
|
19
|
+
return stateUpdate;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {UidInterface} from '../Contexts/PropsContext';
|
|
2
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
3
|
+
|
|
4
|
+
export default function UserMuteRemoteVideo(
|
|
5
|
+
state: UidStateInterface,
|
|
6
|
+
action: ActionType<'UserMuteRemoteVideo'>,
|
|
7
|
+
) {
|
|
8
|
+
let stateUpdate = {};
|
|
9
|
+
const videoMute = (user: UidInterface) => {
|
|
10
|
+
if (user.uid === action.value[0].uid) {
|
|
11
|
+
user.video = action.value[1];
|
|
12
|
+
}
|
|
13
|
+
return user;
|
|
14
|
+
};
|
|
15
|
+
stateUpdate = {
|
|
16
|
+
min: state.min.map(videoMute),
|
|
17
|
+
max: state.max.map(videoMute),
|
|
18
|
+
};
|
|
19
|
+
return stateUpdate;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {ActionType, UidStateInterface} from '../Contexts/RtcContext';
|
|
2
|
+
|
|
3
|
+
export default function UserOffline(
|
|
4
|
+
state: UidStateInterface,
|
|
5
|
+
action: ActionType<'UserOffline'>,
|
|
6
|
+
) {
|
|
7
|
+
let stateUpdate = {};
|
|
8
|
+
if (state.max[0].uid === action.value[0]) {
|
|
9
|
+
//If max has the remote video
|
|
10
|
+
let minUpdate = [...state.min];
|
|
11
|
+
stateUpdate = {
|
|
12
|
+
max: [minUpdate.pop()],
|
|
13
|
+
min: minUpdate,
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
stateUpdate = {
|
|
17
|
+
min: state.min.filter((user) => user.uid !== action.value[0]),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return stateUpdate;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {default as UpdateDualStreamMode} from './UpdateDualStreamMode';
|
|
2
|
+
export {default as UserJoined} from './UserJoined';
|
|
3
|
+
export {default as UserOffline} from './UserOffline';
|
|
4
|
+
export {default as UserMuteRemoteAudio} from './UserMuteRemoteAudio';
|
|
5
|
+
export {default as UserMuteRemoteVideo} from './UserMuteRemoteVideo';
|
|
6
|
+
export {default as LocalMuteAudio} from './LocalMuteAudio';
|
|
7
|
+
export {default as LocalMuteVideo} from './LocalMuteVideo';
|
|
8
|
+
export {default as RemoteAudioStateChanged} from './RemoteAudioStateChanged';
|
|
9
|
+
export {default as RemoteVideoStateChanged} from './RemoteVideoStateChanged';
|