This commit is contained in:
parent
a34a9423bc
commit
762ccefc66
|
|
@ -119,6 +119,7 @@ const Meeting: React.FC = () => {
|
||||||
const [currentLookUserAccount, setCurrentLookUserAccount] = useState<any>('')
|
const [currentLookUserAccount, setCurrentLookUserAccount] = useState<any>('')
|
||||||
const [recorder, setRecorder] = useState<any>('')
|
const [recorder, setRecorder] = useState<any>('')
|
||||||
const [mediaStream, setMediaStream] = useState<any>('')
|
const [mediaStream, setMediaStream] = useState<any>('')
|
||||||
|
const [isShare, setIsShare] = useState<any>(false)
|
||||||
const [currentLookUserStatus, setCurrentLookUserStatus] = useState<1 | 2 | 3 | 4>(1)
|
const [currentLookUserStatus, setCurrentLookUserStatus] = useState<1 | 2 | 3 | 4>(1)
|
||||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -158,7 +159,9 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserJoined: async (info: any, remoteUid: any, _elapsed: any) => {
|
onUserJoined: async (info: any, remoteUid: any, _elapsed: any) => {
|
||||||
if (String(remoteUid).length !== 9) {
|
if (String(remoteUid).length === 9) {
|
||||||
|
setIsShare(true)
|
||||||
|
} else {
|
||||||
await getRoomUser()
|
await getRoomUser()
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
let view = document.getElementById(`video-${remoteUid}`) as HTMLElement;
|
let view = document.getElementById(`video-${remoteUid}`) as HTMLElement;
|
||||||
|
|
@ -174,6 +177,9 @@ const Meeting: React.FC = () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
|
onUserOffline: async (info: any, remoteUid: any, _reason: any) => {
|
||||||
|
if (String(remoteUid).length === 9) {
|
||||||
|
setIsShare(false)
|
||||||
|
}
|
||||||
await agora.setupRemoteVideo({
|
await agora.setupRemoteVideo({
|
||||||
uid: Number(remoteUid),
|
uid: Number(remoteUid),
|
||||||
view: null,
|
view: null,
|
||||||
|
|
@ -444,6 +450,7 @@ const Meeting: React.FC = () => {
|
||||||
setIsSharedScreenModal(true)
|
setIsSharedScreenModal(true)
|
||||||
break;
|
break;
|
||||||
case '停止共享':
|
case '停止共享':
|
||||||
|
await agora.leaveChannelEx(user.screenShareId)
|
||||||
agora.stopScreenCapture()
|
agora.stopScreenCapture()
|
||||||
await allUserLook(user.uid)
|
await allUserLook(user.uid)
|
||||||
footerListTemplate[itemIndex][rowIndex].title = '共享屏幕'
|
footerListTemplate[itemIndex][rowIndex].title = '共享屏幕'
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ const agora = {
|
||||||
},
|
},
|
||||||
// 共享屏幕单独用户
|
// 共享屏幕单独用户
|
||||||
joinChannelEx: async (uid: any) => {
|
joinChannelEx: async (uid: any) => {
|
||||||
await rtcEngine.leaveChannelEx({ channelId: option.channelId, localUid: Number(uid) })
|
await agora.leaveChannelEx(uid)
|
||||||
await rtcEngine.joinChannelEx(
|
await rtcEngine.joinChannelEx(
|
||||||
option.token,
|
option.token,
|
||||||
{ channelId: option.channelId, localUid: Number(uid) },
|
{ channelId: option.channelId, localUid: Number(uid) },
|
||||||
|
|
@ -155,6 +155,10 @@ const agora = {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
// 离开共享屏幕频道
|
||||||
|
leaveChannelEx: async (uid: any) => {
|
||||||
|
await rtcEngine.leaveChannelEx({ channelId: option.channelId, localUid: Number(uid) })
|
||||||
|
},
|
||||||
// 停止共享屏幕
|
// 停止共享屏幕
|
||||||
stopScreenCapture: () => {
|
stopScreenCapture: () => {
|
||||||
rtcEngine.stopScreenCapture();
|
rtcEngine.stopScreenCapture();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue