Update server
This commit is contained in:
parent
e22093d97e
commit
742d67f2e3
@ -154,84 +154,40 @@ const streamSuccess = (stream) => {
|
||||
|
||||
const getLocalStream = () => {
|
||||
console.log('[getLocalStream]');
|
||||
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)
|
||||
})
|
||||
|
||||
navigator.permissions.query(
|
||||
{ name: 'microphone' }
|
||||
).then(function(permissionStatus) {
|
||||
|
||||
console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt
|
||||
console.log('🟨 [PERMISSION] onchange1', permissionStatus.state); // granted, denied, prompt
|
||||
|
||||
// If he has entered before, the saved access is already saved
|
||||
if (permissionStatus === 'grated') {
|
||||
doIHaveAudio = true;
|
||||
}
|
||||
// If he has entered before, the saved access is already saved
|
||||
if (permissionStatus === 'grated') {
|
||||
doIHaveAudio = true;
|
||||
}
|
||||
|
||||
// 🟨 [PERMISSION] onchange denied
|
||||
// If it is the first time client enter and give permission
|
||||
permissionStatus.onchange = function() {
|
||||
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;
|
||||
console.log('Getting user permission');
|
||||
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)
|
||||
// .catch(error => {
|
||||
// console.log(error.message)
|
||||
// })
|
||||
// If it is the first time client enter and give permission
|
||||
permissionStatus.onchange = function() {
|
||||
console.log('🟨 [PERMISSION] onchange2', this.state);
|
||||
if (this.state === 'grated') {
|
||||
// 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) => {
|
||||
|
||||
// return streamSuccess
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.log(error.message)
|
||||
// })
|
||||
}
|
||||
|
||||
const goConnect = () => {
|
||||
@ -375,7 +331,6 @@ const connectSendTransport = async () => {
|
||||
// close video track
|
||||
})
|
||||
|
||||
console.log('doIHaveAudio', doIHaveAudio);
|
||||
// Video is mandatory, but audio may not be included
|
||||
// if (doIHaveAudio) {
|
||||
console.log('audioParams', audioParams);
|
||||
|
Loading…
Reference in New Issue
Block a user