diff --git a/public/main.js b/public/main.js index fb4eb78..1add5bb 100644 --- a/public/main.js +++ b/public/main.js @@ -25,6 +25,9 @@ var app = new Vue({ videoCalls:[], connections: [], chatInput: '', + displayMediaStrean: false, + outgoingScreenShareCalls: [], + incomingScreenShareCalls: [], }, methods: { logMessage: function(message) { @@ -299,10 +302,9 @@ var app = new Vue({ }, getAudioStream: async function getAudioStream() { const audioSource = document.querySelector('select#audioSource').value; - // const videoSource = document.querySelector('select#videoSource').value; const constraints = { audio: {deviceId: audioSource ? {exact: audioSource} : undefined}, - // video: {deviceId: undefined} + video: null }; const audioStream = await navigator.mediaDevices.getUserMedia(constraints).catch(this.handleError); console.log('GOT AUDIO STREAM', audioStream); @@ -320,18 +322,13 @@ var app = new Vue({ return videoStream; }, shareScreen: async function shareScreen() { - // if (!displayMediaStream) { + if (!this.displayMediaStream) { const displayMediaStream = await navigator.mediaDevices.getDisplayMedia(); console.log('screenShare', displayMediaStream) - // } - // senders.find(sender => sender.track.kind === 'video').replaceTrack(displayMediaStream.getTracks()[0]); - - //show what you are showing in your "self-view" video. - // document.getElementById('self-view').srcObject = displayMediaStream; - - //hide the share button and display the "stop-sharing" one - // document.getElementById('share-button').style.display = 'none'; - // document.getElementById('stop-share-button').style.display = 'inline'; + } else { + // TODO stop stream + this.displayMediaStream = false; + } }, handleError: function handleError(error) { console.log('navigator.MediaDevices.getUserMedia error: ', error.message, error.name); diff --git a/views/index.ejs b/views/index.ejs index 1c44b10..938e96f 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -51,7 +51,7 @@