我还在Zoom社区发布了这个话题,但仍然没有得到回复。
情境化
我一直在跟踪文档,以便使用React实现屏幕共享功能。
不过,它只向已启动的用户显示共享屏幕,而其他人则没有看到它。
当共享停止时,我会得到这个错误(共享开始时没有错误)
TypeError:无法在c2f9e9ce-c03d-429c-a087-fb847ca77016:1:111290处读取未定义(读取‘contextGL’)的属性,在c2f9e9ce-c03d-429c-a087-fb847ca77016:1:111392处读取。
实际代码
// For rendering received screen share stream
client.on('active-share-change',async payload =>{
const target = client.getAllUser().find(item => item.userId === payload.userId)
// const video = document.querySelector(`.user_media.video[data-video_id="${target?.displayName}"]`)
// Also Tried with video element above (reference to the share started user's video tag), but the result was same.
const testVideo = document.querySelector('.share-canvas#test_video')
if(payload.state === 'Active' ){
console.log('STARTED!')
console.log(payload.userId)
try {
await stream.startShareView(testVideo,payload.userId)
} catch (error){
console.log(error)
}
}else if(payload.state === 'Inactive'){
try {
await stream.stopShareView()
} catch (error) {
console.log(error)
}
}
})
// ~~~~~~~~ different file ~~~~~~~~~
// For start sharing screen
const startShareScreen = () => {
const testVideo = document.querySelector('.share-canvas#test_video')
stream.startShareScreen(testVideo)
}请帮帮忙!
发布于 2022-11-01 00:43:05
请检查是否使用画布,您可以删除画布并再次创建元素画布,或者在加载共享屏幕之前可以使用https://www.w3schools.com/tags/canvas_clearrect.asp清除画布。
https://stackoverflow.com/questions/70958649
复制相似问题