This commit is contained in:
yj 2024-08-07 14:15:41 +08:00
parent 690dfe2e13
commit fc52c1b938
2 changed files with 28 additions and 2 deletions

View File

@ -113,9 +113,9 @@ const Meeting: React.FC = () => {
const [userSearchValue, setUserSearchValue] = useState('')
const [noViewChatList, setNoViewChatList] = useState(0)
const [currentLookUserAccount, setCurrentLookUserAccount] = useState<string>('')
let userInfo = JSON.parse(storage.getItem('user') as string)
useEffect(() => {
let time = null as any;
let userInfo = JSON.parse(storage.getItem('user') as string)
setUser(userInfo)
setMeetingMode('StandardMode');
agora.init(true)
@ -295,9 +295,34 @@ const Meeting: React.FC = () => {
}
// 全员观看
const getShowUser = async (): Promise<void> => {
await GetShowUser(state.channelId).then(res => {
await GetShowUser(state.channelId).then(async (res) => {
if (res.code === 200 && res.data) {
setCurrentLookUserAccount(res.data)
if (res.data === userInfo.uid) {
if (String(res.data).length === 9) {
// 共享屏幕
await agora.setupLocalVideo({
uid: Number(res.data),
view: document.getElementById(`look-video`) as HTMLElement,
channelId: state.channelId,
sourceType: VideoSourceType.VideoSourceScreen,
})
} else {
// 摄像头
await agora.setupLocalVideo({
uid: Number(res.data),
view: document.getElementById(`look-video`) as HTMLElement,
channelId: state.channelId,
sourceType: VideoSourceType.VideoSourceCameraPrimary,
})
}
} else {
await agora.setupRemoteVideoJoin({
uid: Number(res.data),
view: document.getElementById(`look-video`) as HTMLElement,
channelId: state.channelId,
})
}
}
})
}

View File

@ -222,6 +222,7 @@ const agora = {
},
// 销毁视频
destroyRendererByConfig: async (uid: any) => {
// await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceCameraPrimary, option.channelId, Number(uid))
await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceScreen, option.channelId, Number(uid))
await rtcEngine.destroyRendererByConfig(VideoSourceType.VideoSourceRemote, option.channelId, Number(uid))
},