恢复轮流接流代码
This commit is contained in:
parent
09aaae8274
commit
27d3a59438
|
|
@ -174,7 +174,6 @@ const Meeting: React.FC = () => {
|
|||
}
|
||||
});
|
||||
const [isVideoFullScreen, setIsVideoFullScreen] = useState<boolean>(false)
|
||||
const [observer, setObserver] = useState<IntersectionObserver>()
|
||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||
const msgTips = '您不是管理员或发言人,无法开启此功能!'
|
||||
useEffect(() => {
|
||||
|
|
@ -584,33 +583,6 @@ 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]);
|
||||
|
||||
// 声网初始化
|
||||
const agoraInit = async () => {
|
||||
await agora.init(true)
|
||||
|
|
@ -1538,7 +1510,7 @@ const Meeting: React.FC = () => {
|
|||
{roomUserList.map((item: any, index: number) => {
|
||||
return (index <= 19 && item.isRoom && item.isAdmin ? <div
|
||||
id={item.uid}
|
||||
className={`${styles.meetingContentSwiperCard} intersectionObserver-view`}
|
||||
className={`${styles.meetingContentSwiperCard}`}
|
||||
key={index}
|
||||
onClick={() => {
|
||||
if (String(isShare) === item.screenShareId) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue