Compare commits

...

2 Commits

Author SHA1 Message Date
fc745a5879 Update server 2022-11-29 11:09:10 +02:00
742d67f2e3 Update server 2022-11-29 11:08:12 +02:00
2 changed files with 46 additions and 136 deletions

View File

@ -20512,24 +20512,6 @@ const streamSuccess = (stream) => {
const getLocalStream = () => { const getLocalStream = () => {
console.log('[getLocalStream]'); console.log('[getLocalStream]');
navigator.permissions.query(
{ name: 'microphone' }
).then(function(permissionStatus) {
console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt
// 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({ navigator.mediaDevices.getUserMedia({
audio: true, audio: true,
video: { video: {
@ -20542,54 +20524,28 @@ const getLocalStream = () => {
.catch(error => { .catch(error => {
console.log(error.message) console.log(error.message)
}) })
} else /*if (this.state === 'denied') */ {
doIHaveAudio = false; navigator.permissions.query(
console.log('Getting user permission'); { name: 'microphone' }
navigator.mediaDevices.getUserMedia({ ).then(function(permissionStatus) {
audio: false,
video: { console.log('🟨 [PERMISSION] onchange1', permissionStatus.state); // granted, denied, prompt
qvga : { width: { ideal: 320 }, height: { ideal: 240 } },
vga : { width: { ideal: 640 }, height: { ideal: 480 } }, // If he has entered before, the saved access is already saved
hd : { width: { ideal: 1280 }, height: { ideal: 720 } } if (permissionStatus === 'grated') {
doIHaveAudio = true;
} }
})
.then(streamSuccess) // If it is the first time client enter and give permission
.catch(error => { permissionStatus.onchange = function() {
console.log(error.message) 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)
// .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)
// })
} }
const goConnect = () => { const goConnect = () => {
@ -20733,7 +20689,6 @@ const connectSendTransport = async () => {
// close video track // close video track
}) })
console.log('doIHaveAudio', doIHaveAudio);
// Video is mandatory, but audio may not be included // Video is mandatory, but audio may not be included
// if (doIHaveAudio) { // if (doIHaveAudio) {
console.log('audioParams', audioParams); console.log('audioParams', audioParams);

View File

@ -154,24 +154,6 @@ const streamSuccess = (stream) => {
const getLocalStream = () => { const getLocalStream = () => {
console.log('[getLocalStream]'); console.log('[getLocalStream]');
navigator.permissions.query(
{ name: 'microphone' }
).then(function(permissionStatus) {
console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt
// 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({ navigator.mediaDevices.getUserMedia({
audio: true, audio: true,
video: { video: {
@ -184,54 +166,28 @@ const getLocalStream = () => {
.catch(error => { .catch(error => {
console.log(error.message) console.log(error.message)
}) })
} else /*if (this.state === 'denied') */ {
doIHaveAudio = false; navigator.permissions.query(
console.log('Getting user permission'); { name: 'microphone' }
navigator.mediaDevices.getUserMedia({ ).then(function(permissionStatus) {
audio: false,
video: { console.log('🟨 [PERMISSION] onchange1', permissionStatus.state); // granted, denied, prompt
qvga : { width: { ideal: 320 }, height: { ideal: 240 } },
vga : { width: { ideal: 640 }, height: { ideal: 480 } }, // If he has entered before, the saved access is already saved
hd : { width: { ideal: 1280 }, height: { ideal: 720 } } if (permissionStatus === 'grated') {
doIHaveAudio = true;
} }
})
.then(streamSuccess) // If it is the first time client enter and give permission
.catch(error => { permissionStatus.onchange = function() {
console.log(error.message) 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)
// .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)
// })
} }
const goConnect = () => { const goConnect = () => {
@ -375,7 +331,6 @@ const connectSendTransport = async () => {
// close video track // close video track
}) })
console.log('doIHaveAudio', doIHaveAudio);
// Video is mandatory, but audio may not be included // Video is mandatory, but audio may not be included
// if (doIHaveAudio) { // if (doIHaveAudio) {
console.log('audioParams', audioParams); console.log('audioParams', audioParams);