0

I Also posted this topic in Zoom Community and still got not replies.

[Situtation]

I’ve been following the documentation to implement Screen Sharing feature with React.

Although, it only shows the sharing screen to started user and others doesn’t see it.

When sharing is stopped, I get this error (There’s no error on sharing start)

TypeError: Cannot read properties of undefined (reading ‘contextGL’) at c2f9e9ce-c03d-429c-a087-fb847ca77016:1:111290 at c2f9e9ce-c03d-429c-a087-fb847ca77016:1:111392

Actual Code

// 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)
    }

Please Help!

Nuintee
  • 33
  • 3

1 Answers1

0

Kindly check for using the canvas, you can remove the canvas and create the element canvas again, or before you load the share screen you can clear the canvas using https://www.w3schools.com/tags/canvas_clearrect.asp