Got the following error Cannot read property 'canvas' of null when trying to startShareScreen after stopShareView

I am using zoom video sdk 1.0.3

Here is my scenario that get me into Cannot read property ‘canvas’ of null

I have 2 users (user A and user B) joining zoom. If a user A does a screen sharing, the user B can see it correctly without any issues.
Then user A stops sharing, the user B will see that the screen sharing is stopped.

Now, when the user B starts to do screen sharing, everything is messed up. The only way to fix it is by refreshing the browser.

Below is my implementation to listen to any participant’s screen sharing.

I have a “‘active-share-change’” listener that listens to anyone who start sharing a screen.
When a participant starts to share a screen by calling .startShareScreen,

  1. on that listener, when the state is active, .startShareView is executed.

  2. when the state is Inactive, .stopShareView is executed

        }else if(payload.state==='Inactive'){

That logic works perfectly.

Now thing is not working when the participant is trying to share the content startShareScreen after the .stopShareView is executed.

It seems that the canvas is no longer available as it throws the following error message:
TypeError: Cannot read property ‘canvas’ of null
at VM3 bfa6c1a5-9063-4609-9e03-75d27bdb9de6:1
at VM3 bfa6c1a5-9063-4609-9e03-75d27bdb9de6:1

Can someone please help me with this issue?


Hey @joecodingjourney

Maybe you mistake in the order of parameters.

startShareView(canvas: HTMLCanvasElement, activeUserId: number)


1 Like

Thanks Vic! I have fixed this issue. The zoom documentation needs to be updated though.

1 Like

Thanks for letting us know @joecodingjourney ! :slight_smile:

We will fix the docs. (DEVELOPERS-1233)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.