parent
e06f908816
commit
2777fad3ee
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "WGShare.Metting",
|
||||
"private": true,
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.5",
|
||||
"main": "main.js",
|
||||
"authors": "yj",
|
||||
"description": "智汇享",
|
||||
|
|
|
|||
|
|
@ -632,32 +632,34 @@ const Meeting: React.FC = () => {
|
|||
return () => clearTimeout(timer);
|
||||
}, [isClicked]);
|
||||
|
||||
// useEffect(() => {
|
||||
// const elements = document.querySelectorAll('.intersectionObserver-view');
|
||||
// if (elements.length && currentVideoId) {
|
||||
// elements.forEach(element => {
|
||||
// observer?.unobserve(element);
|
||||
// });
|
||||
// const observerObject = new IntersectionObserver(async (entries: IntersectionObserverEntry[], _observer: IntersectionObserver) => {
|
||||
// entries.forEach(async (entry) => {
|
||||
// if (entry.target.id !== user.uid) {
|
||||
// await agora.muteRemoteVideoStreamEx(Number(entry.target.id), !entry.isIntersecting)
|
||||
// }
|
||||
// });
|
||||
// await agora.muteRemoteVideoStreamEx(Number(currentVideoId), false)
|
||||
// }, { threshold: 0, root: document.getElementById('videoView') });
|
||||
// setObserver(observerObject)
|
||||
// elements.forEach(element => {
|
||||
// observerObject.observe(element);
|
||||
// });
|
||||
// }
|
||||
// return () => {
|
||||
// elements.forEach(element => {
|
||||
// observer?.unobserve(element);
|
||||
// });
|
||||
// observer?.disconnect();
|
||||
// }
|
||||
// }, [roomUserList, currentVideoId]);
|
||||
useEffect(() => {
|
||||
const elements = document.querySelectorAll('.intersectionObserver-view');
|
||||
if (elements.length && currentVideoId) {
|
||||
elements.forEach(element => {
|
||||
observer?.unobserve(element);
|
||||
});
|
||||
const observerObject = new IntersectionObserver(async (entries: IntersectionObserverEntry[], _observer: IntersectionObserver) => {
|
||||
entries.forEach(async (entry) => {
|
||||
console.log(entry.isIntersecting,entry.target.id);
|
||||
|
||||
if (entry.target.id !== user.uid) {
|
||||
await agora.muteRemoteVideoStreamEx(Number(entry.target.id), !entry.isIntersecting)
|
||||
}
|
||||
});
|
||||
await agora.muteRemoteVideoStreamEx(Number(currentVideoId), false)
|
||||
}, { threshold: 0, root: document.getElementById('videoView') });
|
||||
setObserver(observerObject)
|
||||
elements.forEach(element => {
|
||||
observerObject.observe(element);
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
elements.forEach(element => {
|
||||
observer?.unobserve(element);
|
||||
});
|
||||
observer?.disconnect();
|
||||
}
|
||||
}, [roomUserList, currentVideoId,footerList]);
|
||||
|
||||
// 声网初始化
|
||||
const agoraInit = async () => {
|
||||
|
|
@ -745,26 +747,28 @@ const Meeting: React.FC = () => {
|
|||
if (item.uid === userInfo.uid) {
|
||||
const footerListTemplate = [...footerList]
|
||||
await agora.getVideoDeviceManager().then(async (res) => {
|
||||
getUserRoomInfo().then(async (r) => {
|
||||
if (res.list.length) {
|
||||
footerListTemplate[0][1].title = item.enableCamera ? '关闭视频' : '开启视频'
|
||||
footerListTemplate[0][1].active = !item.enableCamera
|
||||
await agora.muteLocalVideoStream(!item.enableCamera)
|
||||
await agora.muteLocalVideoStream(r, item.enableMicr,item.enableCamera)
|
||||
} else {
|
||||
footerListTemplate[0][1].title = '开启视频'
|
||||
footerListTemplate[0][1].active = true
|
||||
await agora.muteLocalVideoStream(true)
|
||||
await agora.muteLocalVideoStream(r, item.enableMicr,false)
|
||||
}
|
||||
})
|
||||
})
|
||||
await agora.getAudioMediaList().then(async (res) => {
|
||||
getUserRoomInfo().then(async (r) => {
|
||||
if (res.ecordingList.length) {
|
||||
footerListTemplate[0][0].title = item.enableMicr ? '静音' : '解除静音'
|
||||
footerListTemplate[0][0].active = !item.enableMicr
|
||||
await agora.muteLocalAudioStream(r, item.enableMicr)
|
||||
await agora.muteLocalAudioStream(r, item.enableMicr,item.enableCamera)
|
||||
} else {
|
||||
footerListTemplate[0][0].title = '解除静音'
|
||||
footerListTemplate[0][0].active = true
|
||||
await agora.muteLocalAudioStream(r, false)
|
||||
await agora.muteLocalAudioStream(r, false,item.enableCamera)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -321,20 +321,28 @@ export const agora = {
|
|||
rtcEngine.enableLoopbackRecording(false)
|
||||
},
|
||||
// 取消或恢复发布本地音频流
|
||||
muteLocalAudioStream: async (data: any, mute: any) => {
|
||||
muteLocalAudioStream: async (data: any, publishMicrophoneTrack: boolean,publishCameraTrack:boolean) => {
|
||||
// await rtcEngine.muteLocalAudioStream(mute)
|
||||
await rtcEngine.updateChannelMediaOptions({
|
||||
clientRoleType: data ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||
publishMicrophoneTrack: mute,//设置是否发布麦克风采集到的音频
|
||||
publishCameraTrack: true,//设置是否发布摄像头采集的视频
|
||||
publishMicrophoneTrack: publishMicrophoneTrack,//设置是否发布麦克风采集到的音频
|
||||
publishCameraTrack: publishCameraTrack,//设置是否发布摄像头采集的视频
|
||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||
})
|
||||
},
|
||||
// 取消或恢复发布本地视频流
|
||||
muteLocalVideoStream: async (mute: any) => {
|
||||
await rtcEngine.muteLocalVideoStream(mute)
|
||||
muteLocalVideoStream: async (data: any, publishMicrophoneTrack: boolean,publishCameraTrack:boolean) => {
|
||||
// await rtcEngine.muteLocalVideoStream(mute)
|
||||
await rtcEngine.updateChannelMediaOptions({
|
||||
clientRoleType: data ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||
publishMicrophoneTrack: publishMicrophoneTrack,//设置是否发布麦克风采集到的音频
|
||||
publishCameraTrack: publishCameraTrack,//设置是否发布摄像头采集的视频
|
||||
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||
})
|
||||
},
|
||||
// 摄像头采集
|
||||
startCameraCapture: async (bool: boolean = false) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue