Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')

Hey @tommy and @vic.yang ,
When screen share is already going on and I start video call as well then I’m getting below mentioned error, and after this error users video doesn’t render.

Browser Console Error

f7be4d41-54d4-4be0-8b9f-9c8a36354d96:1 Uncaught TypeError: Cannot read properties of undefined (reading ‘forEach’)
at f.Clear_OffScreenCavas (f7be4d41-54d4-4be0-8b9f-9c8a36354d96:1:190959)
at f7be4d41-54d4-4be0-8b9f-9c8a36354d96:1:163236

Which Web Video SDK version?
1.3.0

Any idea on what could be the reason of this issue? and how can I avoid such issues?

Hey @shoaib

Thanks for your feedback.

Did you have the same issue with our sample app? Could you share the code snippet for us to troubleshoot?

Thanks
Vic

1 Like

hey @vic.yang , I was able to resolve this.

So, when there is only screenshare on then I was not rendering video canvas, and only If user start video call then video canvas was getting rendered (or constructed). This destruction and reconstruction of video canvas was I think causing OffScreenCavas issue.

Now, I just hide video canvas when there only screenshare on.

Maybe you can also explicitly mention this somewhere in the Video SDK guide that we need to have both video canvas and screen share canvas rendered every time in the application to avoid destruction and reconstruction of canvases.

Hey @shoaib ,

Thanks for the feedback. I agree this would be valuable for the docs.

When you say destruction and reconstruction of the Video / Canvas do you mean you were removing it from the DOM?

We can update our docs to guide on using CSS hide/display properties and not DOM tree removal if that is what you are proposing. :slight_smile:

-Tommy

Yes.

Yeah, clearly its causing the issue, So why not mention it somewhere as well, but its just a suggestion :slightly_smiling_face:

Hey @shoaib ,

The docs will be updated to reflect this here: Video

It will be published later this week. :slight_smile:

Thanks again for the suggestion!

-Tommy

1 Like