From d17b035526d06dbdd999fd1c05cb84fce66acd13 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Tue, 29 Nov 2022 04:03:06 +0200 Subject: [PATCH] Update server --- public/bundle.js | 53 ++++++++++++++++++++++++++++++++++-------------- public/index.js | 53 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 76 insertions(+), 30 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index 2093202..95c783d 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20529,22 +20529,45 @@ const getLocalStream = () => { console.log('🟨 [PERMISSION] onchange', this.state); if (this.state === 'granted') { doIHaveAudio = true; + navigator.mediaDevices.getUserMedia({ + audio: true, + video: { + qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + } + }) + .then(streamSuccess) + .catch(error => { + console.log(error.message) + }) + } else if (this.state === 'denied') { + doIHaveAudio = false; + navigator.mediaDevices.getUserMedia({ + audio: false, + video: { + qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + } + }) + .then(streamSuccess) + .catch(error => { + console.log(error.message) + }) } - navigator.mediaDevices.getUserMedia({ - audio: true, - video: { - qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, - vga : { width: { ideal: 640 }, height: { ideal: 480 } }, - hd : { width: { ideal: 1280 }, height: { ideal: 720 } } - } - }) - .then((streamSuccess) => { - - return streamSuccess - }) - .catch(error => { - console.log(error.message) - }) + // navigator.mediaDevices.getUserMedia({ + // audio: true, + // video: { + // qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + // vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + // hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + // } + // }) + // .then(streamSuccess) + // .catch(error => { + // console.log(error.message) + // }) } }) diff --git a/public/index.js b/public/index.js index f746b01..bf5664f 100644 --- a/public/index.js +++ b/public/index.js @@ -171,22 +171,45 @@ const getLocalStream = () => { console.log('🟨 [PERMISSION] onchange', this.state); if (this.state === 'granted') { doIHaveAudio = true; + navigator.mediaDevices.getUserMedia({ + audio: true, + video: { + qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + } + }) + .then(streamSuccess) + .catch(error => { + console.log(error.message) + }) + } else if (this.state === 'denied') { + doIHaveAudio = false; + navigator.mediaDevices.getUserMedia({ + audio: false, + video: { + qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + } + }) + .then(streamSuccess) + .catch(error => { + console.log(error.message) + }) } - navigator.mediaDevices.getUserMedia({ - audio: true, - video: { - qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, - vga : { width: { ideal: 640 }, height: { ideal: 480 } }, - hd : { width: { ideal: 1280 }, height: { ideal: 720 } } - } - }) - .then((streamSuccess) => { - - return streamSuccess - }) - .catch(error => { - console.log(error.message) - }) + // navigator.mediaDevices.getUserMedia({ + // audio: true, + // video: { + // qvga : { width: { ideal: 320 }, height: { ideal: 240 } }, + // vga : { width: { ideal: 640 }, height: { ideal: 480 } }, + // hd : { width: { ideal: 1280 }, height: { ideal: 720 } } + // } + // }) + // .then(streamSuccess) + // .catch(error => { + // console.log(error.message) + // }) } })