agora-appbuilder-core 4.0.24 → 4.0.25-beta-2
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 +1 -1
- package/template/agora-rn-uikit/.eslintrc.js +0 -5
- package/template/agora-rn-uikit/package-lock.json +6116 -23528
- package/template/agora-rn-uikit/package.json +14 -14
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +40 -79
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +10 -0
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +17 -26
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +0 -1
- package/template/agora-rn-uikit/src/Controls/Icons.ts +0 -51
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -6
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +1 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +2 -5
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +2 -5
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -0
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -7
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +4 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +1 -3
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +4 -5
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +7 -8
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +7 -8
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +8 -7
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +9 -9
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +8 -7
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +13 -14
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +6 -5
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +3 -20
- package/template/agora-rn-uikit/src/Reducer/index.ts +1 -2
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +125 -122
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +27 -46
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +77 -175
- package/template/agora-rn-uikit/src/Utils/quality.tsx +0 -8
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +12 -56
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +17 -47
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +11 -19
- package/template/agora-rn-uikit/src/index.ts +9 -16
- package/template/customization-api/typeDefinition.ts +1 -4
- package/template/customization-api/utils.ts +1 -0
- package/template/defaultConfig.js +2 -0
- package/template/global.d.ts +2 -0
- package/template/src/AppRoutes.tsx +1 -7
- package/template/src/auth/AuthProvider.tsx +70 -24
- package/template/src/auth/useIDPAuth.electron.tsx +59 -2
- package/template/src/auth/useIDPAuth.native.tsx +59 -2
- package/template/src/auth/useIDPAuth.tsx +60 -2
- package/template/src/auth/useTokenAuth.tsx +66 -4
- package/template/src/components/DeviceConfigure.tsx +74 -68
- package/template/src/components/GraphQLProvider.tsx +0 -1
- package/template/src/components/contexts/WaitingRoomContext.tsx +11 -4
- package/template/src/components/recording-bot/RecordingBotRoute.tsx +1 -1
- package/template/src/components/useUserPreference.tsx +56 -9
- package/template/src/components/whiteboard/WhiteboardConfigure.tsx +4 -1
- package/template/src/components/whiteboard/WhiteboardToolBox.tsx +185 -24
- package/template/src/components/whiteboard/WhiteboardWidget.tsx +47 -6
- package/template/src/logger/AppBuilderLogger.tsx +94 -36
- package/template/src/logger/transports/customer-transport.ts +7 -3
- package/template/src/pages/VideoCall.tsx +3 -5
- package/template/src/subComponents/SelectDevice.tsx +14 -52
- package/template/src/subComponents/caption/useSTTAPI.tsx +39 -3
- package/template/src/subComponents/recording/useRecording.tsx +69 -20
- package/template/src/subComponents/waiting-rooms/useWaitingRoomAPI.ts +30 -8
- package/template/src/utils/common.tsx +6 -1
- package/template/src/utils/useCreateRoom.ts +21 -2
- package/template/src/utils/useFindActiveSpeaker.ts +12 -5
- package/template/src/utils/useGetMeetingPhrase.ts +44 -1
- package/template/src/utils/useJoinRoom.ts +29 -2
- package/template/src/utils/useMutePSTN.ts +29 -0
- package/template/agora-rn-uikit/src/Contexts/ContentContext.tsx +0 -10
- package/template/agora-rn-uikit/src/Contexts/DispatchContext.tsx +0 -22
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeaker.ts +0 -30
- package/template/agora-rn-uikit/src/Reducer/UserSecondaryPin.ts +0 -23
- package/template/agora-rn-uikit/src/Utils/isBotUser.ts +0 -15
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import PropsContext from '../../Contexts/PropsContext';
|
|
3
|
+
import RtcContext, {DispatchType} from '../../Contexts/RtcContext';
|
|
3
4
|
import BtnTemplate from '../BtnTemplate';
|
|
4
5
|
import styles from '../../Style';
|
|
5
6
|
|
|
@@ -7,6 +8,7 @@ function Recording() {
|
|
|
7
8
|
const {styleProps} = useContext(PropsContext);
|
|
8
9
|
const {localBtnStyles} = styleProps || {};
|
|
9
10
|
const {recording} = localBtnStyles || {};
|
|
11
|
+
const {dispatch} = useContext(RtcContext);
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
14
|
<BtnTemplate
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
|
-
import PropsContext,
|
|
2
|
+
import PropsContext,{ToggleState} from '../../Contexts/PropsContext';
|
|
3
3
|
import {LocalContext} from '../../Contexts/LocalUserContext';
|
|
4
4
|
import RtcContext from '../../Contexts/RtcContext';
|
|
5
5
|
import BtnTemplate from '../BtnTemplate';
|
|
6
6
|
import styles from '../../Style';
|
|
7
7
|
|
|
8
|
-
interface Props
|
|
9
|
-
btnText?: string
|
|
8
|
+
interface Props{
|
|
9
|
+
btnText?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function SwitchCamera(props?: Props) {
|
|
13
13
|
const {styleProps, callbacks} = useContext(PropsContext);
|
|
14
14
|
const {localBtnStyles} = styleProps || {};
|
|
15
15
|
const {switchCamera} = localBtnStyles || {};
|
|
16
|
-
const {
|
|
16
|
+
const {RtcEngine} = useContext(RtcContext);
|
|
17
17
|
const local = useContext(LocalContext);
|
|
18
18
|
return (
|
|
19
19
|
<BtnTemplate
|
|
20
|
-
//@ts-ignore
|
|
21
20
|
name={'switchCamera'}
|
|
22
21
|
style={{...styles.localBtn, ...(switchCamera as object)}}
|
|
23
|
-
btnText={props?.btnText ||
|
|
22
|
+
btnText={props?.btnText ||'Switch'}
|
|
24
23
|
disabled={local.video === ToggleState.enabled ? false : true}
|
|
25
24
|
onPress={() => {
|
|
26
|
-
|
|
25
|
+
RtcEngine.switchCamera();
|
|
27
26
|
callbacks?.SwitchCamera && callbacks.SwitchCamera();
|
|
28
27
|
}}
|
|
29
28
|
/>
|
|
@@ -6,7 +6,7 @@ import LocalAudioMute from './Local/LocalAudioMute';
|
|
|
6
6
|
import LocalVideoMute from './Local/LocalVideoMute';
|
|
7
7
|
import SwitchCamera from './Local/SwitchCamera';
|
|
8
8
|
import RemoteControls from './RemoteControls';
|
|
9
|
-
import {
|
|
9
|
+
import {RenderConsumer} from '../Contexts/RenderContext';
|
|
10
10
|
import PropsContext from '../Contexts/PropsContext';
|
|
11
11
|
import LocalUserContextComponent from '../Contexts/LocalUserContext';
|
|
12
12
|
import useLocalUid from '../Utils/useLocalUid';
|
|
@@ -29,16 +29,16 @@ function Controls(props: ControlsPropsInterface) {
|
|
|
29
29
|
<EndCall />
|
|
30
30
|
</View>
|
|
31
31
|
{showButton ? (
|
|
32
|
-
<
|
|
33
|
-
{({
|
|
32
|
+
<RenderConsumer>
|
|
33
|
+
{({renderList, activeUids}) => (
|
|
34
34
|
<View style={{...styles.Controls, top: styles.Controls.top - 100}}>
|
|
35
35
|
<RemoteControls
|
|
36
|
-
user={
|
|
36
|
+
user={renderList[activeUids[0]]}
|
|
37
37
|
showRemoteSwap={false}
|
|
38
38
|
/>
|
|
39
39
|
</View>
|
|
40
40
|
)}
|
|
41
|
-
</
|
|
41
|
+
</RenderConsumer>
|
|
42
42
|
) : (
|
|
43
43
|
<></>
|
|
44
44
|
)}
|
|
@@ -4,27 +4,26 @@ import BtnTemplate from '../BtnTemplate';
|
|
|
4
4
|
import styles from '../../Style';
|
|
5
5
|
import PropsContext, {
|
|
6
6
|
ToggleState,
|
|
7
|
-
|
|
7
|
+
RenderInterface,
|
|
8
8
|
} from '../../Contexts/PropsContext';
|
|
9
9
|
import useLocalUid from '../../Utils/useLocalUid';
|
|
10
10
|
|
|
11
11
|
interface RemoteAudioMuteInterface {
|
|
12
|
-
user:
|
|
12
|
+
user: RenderInterface;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const RemoteAudioMute: React.FC<RemoteAudioMuteInterface> = (props) => {
|
|
16
|
-
const {
|
|
16
|
+
const {RtcEngine} = useContext(RtcContext);
|
|
17
17
|
const {styleProps} = useContext(PropsContext);
|
|
18
18
|
const {remoteBtnStyles} = styleProps || {};
|
|
19
19
|
const {muteRemoteAudio} = remoteBtnStyles || {};
|
|
20
20
|
const localUid = useLocalUid();
|
|
21
21
|
return props.user.uid !== localUid ? (
|
|
22
22
|
<BtnTemplate
|
|
23
|
-
//@ts-ignore
|
|
24
23
|
name={props.user.audio === ToggleState.enabled ? 'mic' : 'micOff'}
|
|
25
24
|
style={{...styles.leftRemoteBtn, ...(muteRemoteAudio as object)}}
|
|
26
25
|
onPress={() => {
|
|
27
|
-
|
|
26
|
+
RtcEngine.muteRemoteAudioStream(
|
|
28
27
|
props.user.uid as number,
|
|
29
28
|
props.user.audio === ToggleState.enabled,
|
|
30
29
|
);
|
|
@@ -4,21 +4,19 @@ import BtnTemplate from '../BtnTemplate';
|
|
|
4
4
|
import styles from '../../Style';
|
|
5
5
|
import PropsContext from '../../Contexts/PropsContext';
|
|
6
6
|
import useLocalUid from '../../Utils/useLocalUid';
|
|
7
|
-
import DispatchContext from '../../Contexts/DispatchContext';
|
|
8
7
|
|
|
9
8
|
interface RemoteSwapInterface {
|
|
10
9
|
uid: UidType;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
const RemoteSwap: React.FC<RemoteSwapInterface> = (props) => {
|
|
14
|
-
const {dispatch} = useContext(
|
|
13
|
+
const {dispatch} = useContext(RtcContext);
|
|
15
14
|
const {styleProps} = useContext(PropsContext);
|
|
16
15
|
const {remoteBtnStyles} = styleProps || {};
|
|
17
16
|
const {remoteSwap} = remoteBtnStyles || {};
|
|
18
17
|
const localUid = useLocalUid();
|
|
19
18
|
return (
|
|
20
19
|
<BtnTemplate
|
|
21
|
-
//@ts-ignore
|
|
22
20
|
name={'remoteSwap'}
|
|
23
21
|
style={
|
|
24
22
|
props.uid !== localUid
|
|
@@ -2,26 +2,25 @@ import React, {useContext} from 'react';
|
|
|
2
2
|
import useLocalUid from '../../Utils/useLocalUid';
|
|
3
3
|
import PropsContext, {
|
|
4
4
|
ToggleState,
|
|
5
|
-
|
|
5
|
+
RenderInterface,
|
|
6
6
|
} from '../../Contexts/PropsContext';
|
|
7
7
|
import RtcContext from '../../Contexts/RtcContext';
|
|
8
8
|
import styles from '../../Style';
|
|
9
9
|
import BtnTemplate from '../BtnTemplate';
|
|
10
10
|
|
|
11
11
|
interface RemoteVideoMuteInterface {
|
|
12
|
-
user:
|
|
12
|
+
user: RenderInterface;
|
|
13
13
|
rightButton: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
|
|
17
|
-
const {
|
|
17
|
+
const {RtcEngine} = useContext(RtcContext);
|
|
18
18
|
const {styleProps} = useContext(PropsContext);
|
|
19
19
|
const {remoteBtnStyles} = styleProps || {};
|
|
20
20
|
const {muteRemoteVideo} = remoteBtnStyles || {};
|
|
21
21
|
const localUid = useLocalUid();
|
|
22
22
|
return props.user.uid !== localUid ? (
|
|
23
23
|
<BtnTemplate
|
|
24
|
-
//@ts-ignore
|
|
25
24
|
name={
|
|
26
25
|
props.user.video === ToggleState.enabled ? 'videocam' : 'videocamOff'
|
|
27
26
|
}
|
|
@@ -31,7 +30,7 @@ const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
|
|
|
31
30
|
: {...(muteRemoteVideo as object)}
|
|
32
31
|
}
|
|
33
32
|
onPress={() => {
|
|
34
|
-
|
|
33
|
+
RtcEngine.muteRemoteVideoStream(
|
|
35
34
|
props.user.uid as number,
|
|
36
35
|
props.user.video === ToggleState.enabled, //If enabled, disable or vice-versa
|
|
37
36
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
|
-
import PropsContext, {
|
|
3
|
+
import PropsContext, {RenderInterface} from '../Contexts/PropsContext';
|
|
4
4
|
import styles from '../Style';
|
|
5
5
|
import RemoteAudioMute from './Remote/RemoteAudioMute';
|
|
6
6
|
import RemoteSwap from './Remote/RemoteSwap';
|
|
@@ -10,7 +10,7 @@ interface RemoteControlsInterface {
|
|
|
10
10
|
showMuteRemoteVideo?: boolean;
|
|
11
11
|
showMuteRemoteAudio?: boolean;
|
|
12
12
|
showRemoteSwap?: boolean;
|
|
13
|
-
user:
|
|
13
|
+
user: RenderInterface;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const RemoteControls: React.FC<RemoteControlsInterface> = (props) => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
2
|
+
|
|
3
|
+
export default function ActiveSpeakerDetected(
|
|
4
|
+
state: RenderStateInterface,
|
|
5
|
+
action: ActionType<'ActiveSpeakerDetected'>,
|
|
6
|
+
) {
|
|
7
|
+
return {
|
|
8
|
+
...state,
|
|
9
|
+
activeSpeaker: action?.value && action.value?.length ? action.value[0] : '',
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionType,
|
|
3
|
-
|
|
3
|
+
RenderStateInterface,
|
|
4
4
|
UidType,
|
|
5
5
|
} from '../Contexts/RtcContext';
|
|
6
6
|
|
|
7
7
|
export default function LocalMuteAudio(
|
|
8
|
-
state:
|
|
8
|
+
state: RenderStateInterface,
|
|
9
9
|
action: ActionType<'LocalMuteAudio'>,
|
|
10
10
|
localUid: UidType,
|
|
11
11
|
) {
|
|
12
|
-
let stateUpdate:
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let stateUpdate: RenderStateInterface = {
|
|
13
|
+
activeSpeaker: state.activeSpeaker,
|
|
14
|
+
renderList: {
|
|
15
|
+
...state.renderList,
|
|
15
16
|
[localUid]: {
|
|
16
|
-
...state.
|
|
17
|
+
...state.renderList[localUid],
|
|
17
18
|
audio: action.value[0],
|
|
18
|
-
audioForceDisabled:
|
|
19
|
-
action?.value?.length === 2 ? action.value[1] : false,
|
|
20
19
|
},
|
|
21
20
|
},
|
|
22
21
|
activeUids: [...state.activeUids],
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionType,
|
|
3
|
-
|
|
3
|
+
RenderStateInterface,
|
|
4
4
|
UidType,
|
|
5
5
|
} from '../Contexts/RtcContext';
|
|
6
6
|
|
|
7
7
|
export default function LocalMuteVideo(
|
|
8
|
-
state:
|
|
8
|
+
state: RenderStateInterface,
|
|
9
9
|
action: ActionType<'LocalMuteVideo'>,
|
|
10
10
|
localUid: UidType,
|
|
11
11
|
) {
|
|
12
|
-
let stateUpdate:
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let stateUpdate: RenderStateInterface = {
|
|
13
|
+
activeSpeaker: state.activeSpeaker,
|
|
14
|
+
renderList: {
|
|
15
|
+
...state.renderList,
|
|
15
16
|
[localUid]: {
|
|
16
|
-
...state.
|
|
17
|
+
...state.renderList[localUid],
|
|
17
18
|
video: action.value[0],
|
|
18
|
-
videoForceDisabled:
|
|
19
|
-
action?.value?.length === 2 ? action.value[1] : false,
|
|
20
19
|
},
|
|
21
20
|
},
|
|
22
21
|
activeUids: [...state.activeUids],
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionType,
|
|
3
|
-
|
|
3
|
+
RenderStateInterface,
|
|
4
4
|
UidType,
|
|
5
5
|
} from '../Contexts/RtcContext';
|
|
6
6
|
|
|
7
7
|
export default function LocalPermissionState(
|
|
8
|
-
state:
|
|
8
|
+
state: RenderStateInterface,
|
|
9
9
|
action: ActionType<'LocalPermissionState'>,
|
|
10
10
|
localUid: UidType,
|
|
11
11
|
) {
|
|
12
|
-
let stateUpdate:
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let stateUpdate: RenderStateInterface = {
|
|
13
|
+
activeSpeaker: state.activeSpeaker,
|
|
14
|
+
renderList: {
|
|
15
|
+
...state.renderList,
|
|
15
16
|
[localUid]: {
|
|
16
|
-
...state.
|
|
17
|
+
...state.renderList[localUid],
|
|
17
18
|
permissionStatus: action.value[0],
|
|
18
19
|
},
|
|
19
20
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ToggleState} from '../Contexts/PropsContext';
|
|
2
|
-
import {ActionType,
|
|
2
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
3
3
|
|
|
4
4
|
export default function RemoteAudioStateChanged(
|
|
5
|
-
state:
|
|
5
|
+
state: RenderStateInterface,
|
|
6
6
|
action: ActionType<'RemoteAudioStateChanged'>,
|
|
7
7
|
) {
|
|
8
8
|
let audioState: ToggleState;
|
|
@@ -12,11 +12,12 @@ export default function RemoteAudioStateChanged(
|
|
|
12
12
|
audioState = ToggleState.disabled;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const stateUpdate:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const stateUpdate: RenderStateInterface = {
|
|
16
|
+
activeSpeaker: state.activeSpeaker,
|
|
17
|
+
renderList: {
|
|
18
|
+
...state.renderList,
|
|
19
|
+
[action.value[0]]: {
|
|
20
|
+
...state.renderList[action.value[0]],
|
|
20
21
|
audio: audioState,
|
|
21
22
|
},
|
|
22
23
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ToggleState} from '../Contexts/PropsContext';
|
|
2
|
-
import {ActionType,
|
|
2
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
3
3
|
|
|
4
4
|
export default function RemoteVideoStateChanged(
|
|
5
|
-
state:
|
|
5
|
+
state: RenderStateInterface,
|
|
6
6
|
action: ActionType<'RemoteVideoStateChanged'>,
|
|
7
7
|
) {
|
|
8
8
|
let videoState: ToggleState;
|
|
@@ -12,16 +12,16 @@ export default function RemoteVideoStateChanged(
|
|
|
12
12
|
videoState = ToggleState.enabled;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const stateUpdate:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const stateUpdate: RenderStateInterface = {
|
|
16
|
+
activeSpeaker: state.activeSpeaker,
|
|
17
|
+
renderList: {
|
|
18
|
+
...state.renderList,
|
|
19
|
+
[action.value[0]]: {
|
|
20
|
+
...state.renderList[action.value[0]],
|
|
20
21
|
video:
|
|
21
|
-
//@ts-ignore
|
|
22
22
|
videoState !== undefined
|
|
23
23
|
? videoState
|
|
24
|
-
: state.
|
|
24
|
+
: state.renderList[action.value[0]].video,
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
activeUids: [...state.activeUids],
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {DualStreamMode} from '../Contexts/PropsContext';
|
|
2
2
|
import {
|
|
3
3
|
ActionType,
|
|
4
|
-
|
|
4
|
+
RenderStateInterface,
|
|
5
5
|
UidType,
|
|
6
6
|
} from '../Contexts/RtcContext';
|
|
7
7
|
|
|
8
8
|
export default function UpdateDualStreamMode(
|
|
9
|
-
state:
|
|
9
|
+
state: RenderStateInterface,
|
|
10
10
|
action: ActionType<'UpdateDualStreamMode'>,
|
|
11
11
|
) {
|
|
12
12
|
const newMode = action.value[0];
|
|
13
|
-
let
|
|
14
|
-
let stateUpdate:
|
|
13
|
+
let renderList = {...state.renderList};
|
|
14
|
+
let stateUpdate: RenderStateInterface;
|
|
15
15
|
const setHighStreamType = (uid: UidType) => {
|
|
16
|
-
|
|
16
|
+
renderList[uid].streamType = 'high';
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const setLowStreamType = (uid: UidType) => {
|
|
20
|
-
|
|
20
|
+
renderList[uid].streamType = 'low';
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
if (newMode === DualStreamMode.HIGH) {
|
|
@@ -36,7 +36,8 @@ export default function UpdateDualStreamMode(
|
|
|
36
36
|
minUids.forEach(setLowStreamType);
|
|
37
37
|
}
|
|
38
38
|
stateUpdate = {
|
|
39
|
-
|
|
39
|
+
activeSpeaker: state.activeSpeaker,
|
|
40
|
+
renderList: renderList,
|
|
40
41
|
activeUids: [...state.activeUids],
|
|
41
42
|
};
|
|
42
43
|
return stateUpdate;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {DualStreamMode, ToggleState} from '../Contexts/PropsContext';
|
|
2
2
|
import {
|
|
3
3
|
ActionType,
|
|
4
|
-
|
|
4
|
+
RenderStateInterface,
|
|
5
5
|
UidType,
|
|
6
6
|
} from '../Contexts/RtcContext';
|
|
7
7
|
|
|
8
8
|
export default function UserJoined(
|
|
9
|
-
state:
|
|
9
|
+
state: RenderStateInterface,
|
|
10
10
|
action: ActionType<'UserJoined'>,
|
|
11
11
|
dualStreamMode: DualStreamMode,
|
|
12
12
|
localUid: UidType,
|
|
@@ -17,17 +17,14 @@ export default function UserJoined(
|
|
|
17
17
|
let typeData = {
|
|
18
18
|
type: 'rtc',
|
|
19
19
|
};
|
|
20
|
-
if (
|
|
21
|
-
state.
|
|
22
|
-
'type' in state.defaultContent[newUid as unknown as number]
|
|
23
|
-
) {
|
|
24
|
-
typeData.type = state.defaultContent[newUid as unknown as number].type;
|
|
20
|
+
if (state.renderList[newUid] && 'type' in state.renderList[newUid]) {
|
|
21
|
+
typeData.type = state.renderList[newUid].type;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
let
|
|
28
|
-
...state.
|
|
29
|
-
[newUid
|
|
30
|
-
...state.
|
|
24
|
+
let renderList: RenderStateInterface['renderList'] = {
|
|
25
|
+
...state.renderList,
|
|
26
|
+
[newUid]: {
|
|
27
|
+
...state.renderList[newUid],
|
|
31
28
|
uid: newUid,
|
|
32
29
|
audio: ToggleState.disabled,
|
|
33
30
|
video: ToggleState.disabled,
|
|
@@ -43,18 +40,20 @@ export default function UserJoined(
|
|
|
43
40
|
//Only one remote and local is maximized
|
|
44
41
|
//Change stream type to high if dualStreaMode is DYNAMIC
|
|
45
42
|
if (dualStreamMode === DualStreamMode.DYNAMIC) {
|
|
46
|
-
|
|
43
|
+
renderList[newUid].streamType = 'high';
|
|
47
44
|
}
|
|
48
45
|
//Swap render positions
|
|
49
46
|
stateUpdate = {
|
|
50
|
-
|
|
47
|
+
activeSpeaker: state.activeSpeaker,
|
|
48
|
+
renderList: renderList,
|
|
51
49
|
activeUids: activeUids.reverse(),
|
|
52
50
|
lastJoinedUid: newUid,
|
|
53
51
|
};
|
|
54
52
|
} else {
|
|
55
53
|
//More than one remote
|
|
56
54
|
stateUpdate = {
|
|
57
|
-
|
|
55
|
+
activeSpeaker: state.activeSpeaker,
|
|
56
|
+
renderList: renderList,
|
|
58
57
|
activeUids: activeUids,
|
|
59
58
|
lastJoinedUid: newUid,
|
|
60
59
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserMuteRemoteAudio(
|
|
4
|
-
state:
|
|
4
|
+
state: RenderStateInterface,
|
|
5
5
|
action: ActionType<'UserMuteRemoteAudio'>,
|
|
6
6
|
) {
|
|
7
|
-
let stateUpdate:
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let stateUpdate: RenderStateInterface = {
|
|
8
|
+
activeSpeaker: state.activeSpeaker,
|
|
9
|
+
renderList: {
|
|
10
|
+
...state.renderList,
|
|
10
11
|
[action.value[0]]: {
|
|
11
|
-
...state.
|
|
12
|
+
...state.renderList[action.value[0]],
|
|
12
13
|
audio: action.value[1],
|
|
13
14
|
},
|
|
14
15
|
},
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserMuteRemoteVideo(
|
|
4
|
-
state:
|
|
4
|
+
state: RenderStateInterface,
|
|
5
5
|
action: ActionType<'UserMuteRemoteVideo'>,
|
|
6
6
|
) {
|
|
7
|
-
let stateUpdate:
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let stateUpdate: RenderStateInterface = {
|
|
8
|
+
activeSpeaker: state.activeSpeaker,
|
|
9
|
+
renderList: {
|
|
10
|
+
...state.renderList,
|
|
10
11
|
[action.value[0]]: {
|
|
11
|
-
...state.
|
|
12
|
+
...state.renderList[action.value[0]],
|
|
12
13
|
video: action.value[1],
|
|
13
14
|
},
|
|
14
15
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserOffline(
|
|
4
|
-
state:
|
|
4
|
+
state: RenderStateInterface,
|
|
5
5
|
action: ActionType<'UserOffline'>,
|
|
6
6
|
) {
|
|
7
7
|
// let updatedRenderList = {
|
|
8
|
-
// ...state.
|
|
8
|
+
// ...state.renderList,
|
|
9
9
|
// };
|
|
10
10
|
// //don't delete user data from renderlist
|
|
11
11
|
// //we will update user data with {offline:true} from RTM user left event
|
|
@@ -15,8 +15,9 @@ export default function UserOffline(
|
|
|
15
15
|
const updatedActiveUids = [...state.activeUids].filter(
|
|
16
16
|
(uid) => uid !== action.value[0],
|
|
17
17
|
);
|
|
18
|
-
const stateUpdate:
|
|
19
|
-
|
|
18
|
+
const stateUpdate: RenderStateInterface = {
|
|
19
|
+
activeSpeaker: state.activeSpeaker,
|
|
20
|
+
renderList: state.renderList,
|
|
20
21
|
activeUids: updatedActiveUids,
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserPin(
|
|
4
|
-
state:
|
|
4
|
+
state: RenderStateInterface,
|
|
5
5
|
action: ActionType<'UserPin'>,
|
|
6
6
|
) {
|
|
7
|
-
let localActiveUids = [...state.activeUids];
|
|
8
|
-
let secondaryPinnedUid = state.secondaryPinnedUid;
|
|
9
|
-
const pinnedUid =
|
|
10
|
-
action?.value && action.value?.length ? action.value[0] : '';
|
|
11
|
-
if (pinnedUid) {
|
|
12
|
-
const filteredData = localActiveUids?.filter(
|
|
13
|
-
(i) => i !== pinnedUid && i !== secondaryPinnedUid,
|
|
14
|
-
);
|
|
15
|
-
if (secondaryPinnedUid && secondaryPinnedUid !== pinnedUid) {
|
|
16
|
-
filteredData.unshift(secondaryPinnedUid);
|
|
17
|
-
}
|
|
18
|
-
filteredData.unshift(pinnedUid);
|
|
19
|
-
localActiveUids = filteredData;
|
|
20
|
-
}
|
|
21
7
|
return {
|
|
22
8
|
...state,
|
|
23
|
-
pinnedUid,
|
|
24
|
-
secondaryPinnedUid:
|
|
25
|
-
pinnedUid === secondaryPinnedUid ? 0 : secondaryPinnedUid,
|
|
26
|
-
activeUids: localActiveUids,
|
|
9
|
+
pinnedUid: action?.value && action.value?.length ? action.value[0] : '',
|
|
27
10
|
};
|
|
28
11
|
}
|
|
@@ -8,6 +8,5 @@ export {default as LocalMuteVideo} from './LocalMuteVideo';
|
|
|
8
8
|
export {default as LocalPermissionState} from './LocalPermissionState';
|
|
9
9
|
export {default as RemoteAudioStateChanged} from './RemoteAudioStateChanged';
|
|
10
10
|
export {default as RemoteVideoStateChanged} from './RemoteVideoStateChanged';
|
|
11
|
+
export {default as ActiveSpeakerDetected} from './ActiveSpeakerDetected';
|
|
11
12
|
export {default as UserPin} from './UserPin';
|
|
12
|
-
export {default as UserSecondaryPin} from './UserSecondaryPin';
|
|
13
|
-
export {default as ActiveSpeaker} from './ActiveSpeaker';
|