CleverProgrammers/nodejs-zoom-clone

Screen share code

saini3911 opened this issue · 0 comments

i am trying to add screen share in present code .. but it shows on my screen clearly but unable to see on other user screen
code :-

       navigator.mediaDevices.getDisplayMedia({
           video: true, 
           audio:true
       }).then(stream => {
           const video1 = document.createElement('video');
           video1.controls = true;
           addVideoStream(video1,stream)

           
       socket.on('user-connected', userId =>{
           const call = peer.call(userId, stream)
           stream.getVideoTracks()[0].addEventListener('ended', () => {
               video1.remove()
             });
           call.on('close', () => {

           })  
       })
           stream.getVideoTracks()[0].addEventListener('ended', () => {
             video1.remove()
           });
         });
       }catch(err) {
           console.log("Error: " + err);
       }