This commit is contained in:
parent
2791d94a31
commit
beb94a8eba
|
|
@ -79,6 +79,14 @@ const Index: React.FC = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const postRefresh = async (callBack: Function): Promise<void> => {
|
||||||
|
await PostRefresh(user.refresh_token).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
storage.setItem('user', JSON.stringify(res.data))
|
||||||
|
callBack(res.data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.index}>
|
<div className={styles.index}>
|
||||||
|
|
@ -147,21 +155,22 @@ const Index: React.FC = () => {
|
||||||
if (userInfo.roleId === '1') {
|
if (userInfo.roleId === '1') {
|
||||||
joinSettingRef.current.changeModal(item.roomNum)
|
joinSettingRef.current.changeModal(item.roomNum)
|
||||||
} else {
|
} else {
|
||||||
await PostRefresh(userInfo.refresh_token)
|
postRefresh(() => {
|
||||||
getRoomRtcToken(item.roomNum, (options: any) => {
|
getRoomRtcToken(item.roomNum, (options: any) => {
|
||||||
if (options) {
|
if (options) {
|
||||||
navigate(`/meeting`, {
|
navigate(`/meeting`, {
|
||||||
state: {
|
state: {
|
||||||
channelId: item.roomNum,
|
channelId: item.roomNum,
|
||||||
token: options.token,
|
token: options.token,
|
||||||
tokenA: options.tokenA,
|
tokenA: options.tokenA,
|
||||||
roomId: item.id,
|
roomId: item.id,
|
||||||
roomName: item.roomName,
|
roomName: item.roomName,
|
||||||
enableMicr: false,
|
enableMicr: false,
|
||||||
enableCamera: false,
|
enableCamera: false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -223,15 +223,22 @@ const agora = {
|
||||||
await rtcEngine.joinChannelEx(
|
await rtcEngine.joinChannelEx(
|
||||||
option.tokenA,
|
option.tokenA,
|
||||||
{ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) },
|
{ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) },
|
||||||
{
|
{}
|
||||||
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
|
|
||||||
autoSubscribeVideo: false,//设置是否自动订阅所有视频流
|
|
||||||
publishMicrophoneTrack: false,//设置是否发布麦克风采集到的音频
|
|
||||||
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
|
||||||
clientRoleType: ClientRoleType.ClientRoleAudience,//用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
|
||||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
await agora.updateChannelMediaOptionsEx(false)
|
||||||
|
},
|
||||||
|
updateChannelMediaOptionsEx: async (bool: boolean) => {
|
||||||
|
rtcEngine.updateChannelMediaOptionsEx({
|
||||||
|
clientRoleType: bool ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
|
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||||
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
publishMicrophoneTrack: true,//设置是否发布麦克风采集到的音频
|
||||||
|
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
||||||
|
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||||
|
}, {
|
||||||
|
channelId: option.channelId + '1',
|
||||||
|
localUid: Number('1' + option.screenShareId)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 离开共享屏幕频道
|
// 离开共享屏幕频道
|
||||||
leaveChannelEx: async (uid: any) => {
|
leaveChannelEx: async (uid: any) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue