adrianhajdin/project_video_chat

TypeError: Cannot set properties of undefined (setting 'srcObject')

AbhinavNaman opened this issue · 4 comments

Cannot set properties of undefined (setting 'srcObject')
TypeError: Cannot set properties of undefined (setting 'srcObject')
at http://localhost:3000/static/js/bundle.js:181:33

okk

Heyy how did you fix it?

myVideo and userVideo references are initialized to null via useRef(). Hence, myVideo.current and currentVideo.current are null, which is why you see the above error.

The solution is to assign a value to this reference which is done here.

See more details about setting reference via the refs property here.

just delete the part of this
{stream && () }
It's because your ref doesn't create before you run a streaming video.