优化第二个房间号名称

This commit is contained in:
yj 2024-09-03 17:30:36 +08:00
parent eeccf9a462
commit e645c13158
4 changed files with 6 additions and 6 deletions

View File

@ -71,7 +71,7 @@ const JoinSetting = forwardRef((_props: any, ref: any) => {
})
}
const getRoomRtcToken = async (roomNum: string, callBack: Function): Promise<void> => {
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + '1')]).then(res => {
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a')]).then(res => {
if (res[0].code === 200 && res[1].code === 200) {
callBack({
token: res[0].data,

View File

@ -62,7 +62,7 @@ const UserVideo: React.FC = () => {
agora.setupRemoteVideoEx({
uid: Number('1' + item.screenShareId),
view: document.getElementById(`video-${item.screenShareId}`),
channelId: state.channelId + '1',
channelId: state.channelId + 'a',
})
})
}, [userList])
@ -75,7 +75,7 @@ const UserVideo: React.FC = () => {
// 获取轮训用户
const getPolling = async (): Promise<void> => {
setUserList([])
GetPolling(state.channelId?.split('1')[0] as string, from.viewPeopleValue).then((res: any) => {
GetPolling(state.channelId?.split('a')[0] as string, from.viewPeopleValue).then((res: any) => {
if (res.code === 200) {
setUserList(res.data)
}

View File

@ -70,7 +70,7 @@ const Index: React.FC = () => {
})
}
const getRoomRtcToken = async (roomNum: string, callBack: Function): Promise<void> => {
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + '1')]).then(res => {
Promise.all([GetRoomRtcToken(roomNum), GetRoomRtcToken(roomNum + 'a')]).then(res => {
if (res[0].code === 200 && res[1].code === 200) {
callBack({
token: res[0].data,

View File

@ -240,7 +240,7 @@ export const agora = {
await agora.startCameraCapture()
await rtcEngine.joinChannelEx(
option.tokenA,
{ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) },
{ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) },
{
clientRoleType: bool ? ClientRoleType.ClientRoleAudience : ClientRoleType.ClientRoleBroadcaster , //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
autoSubscribeAudio: false,//设置是否自动订阅所有音频流
@ -254,7 +254,7 @@ export const agora = {
// 退出第二个房间
allLeaveChannelEx: async () => {
await agora.stopCameraCapture();
await rtcEngine.leaveChannelEx({ channelId: option.channelId + '1', localUid: Number('1' + option.screenShareId) })
await rtcEngine.leaveChannelEx({ channelId: option.channelId + 'a', localUid: Number('1' + option.screenShareId) })
},
// 离开共享屏幕频道
leaveChannelEx: async (uid: any) => {