Description
When a participant tries to share the screen by executing the below code, it throws error :“Cannot read property ‘canvas’ of null”.
async shareScreen() {
const canvas = document.getElementById('videoCanvas');
await stream.startShareScreen(canvas);
}
I have a “‘active-share-change’” listener that listens to the user who starts sharing the screen by calling startShareScreen.
client.on('active-share-change', async (payload) =>{
const canvas = document.getElementById('videoCanvas');
if(payload.state==='Active') {
await stream.startShareView(canvas, payload.userId);
} else if(payload.state==='Inactive'){
await stream.stopShareView();
}
}
Note: I am reusing this canvas for the video.
Error
TypeError: Cannot read property ‘canvas’ of null
Which Web Video SDK version?
SDK version : 1.1.4
Device (please complete the following information):
- OS: Ubuntu 18.04.4 LTS
- Browser: Chrome
- Browser Version : Version 93.0.4577.63 (Official Build) (64-bit)
Additional context
Please let me know if I need to do any setup or have to follow any steps to use the screen sharing api in our web based application.