Compare commits
No commits in common. "fc745a58790d3f152ed535ba2c62c7574f08a643" and "e22093d97e080e28b558dd206b0cbc893fba4bb8" have entirely different histories.
fc745a5879
...
e22093d97e
@ -20512,40 +20512,84 @@ const streamSuccess = (stream) => {
|
|||||||
|
|
||||||
const getLocalStream = () => {
|
const getLocalStream = () => {
|
||||||
console.log('[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(
|
navigator.permissions.query(
|
||||||
{ name: 'microphone' }
|
{ name: 'microphone' }
|
||||||
).then(function(permissionStatus) {
|
).then(function(permissionStatus) {
|
||||||
|
|
||||||
console.log('🟨 [PERMISSION] onchange1', permissionStatus.state); // granted, denied, prompt
|
console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt
|
||||||
|
|
||||||
// If he has entered before, the saved access is already saved
|
// If he has entered before, the saved access is already saved
|
||||||
if (permissionStatus === 'grated') {
|
if (permissionStatus === 'grated') {
|
||||||
doIHaveAudio = true;
|
doIHaveAudio = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it is the first time client enter and give permission
|
// 🟨 [PERMISSION] onchange denied
|
||||||
permissionStatus.onchange = function() {
|
// If it is the first time client enter and give permission
|
||||||
console.log('🟨 [PERMISSION] onchange2', this.state);
|
permissionStatus.onchange = function() {
|
||||||
if (this.state === 'grated') {
|
console.log('🟨 [PERMISSION] onchange', this.state);
|
||||||
// doIHaveAudio = true;
|
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)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 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 = () => {
|
||||||
@ -20689,6 +20733,7 @@ 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);
|
||||||
|
@ -154,40 +154,84 @@ const streamSuccess = (stream) => {
|
|||||||
|
|
||||||
const getLocalStream = () => {
|
const getLocalStream = () => {
|
||||||
console.log('[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(
|
navigator.permissions.query(
|
||||||
{ name: 'microphone' }
|
{ name: 'microphone' }
|
||||||
).then(function(permissionStatus) {
|
).then(function(permissionStatus) {
|
||||||
|
|
||||||
console.log('🟨 [PERMISSION] onchange1', permissionStatus.state); // granted, denied, prompt
|
console.log('🟨 [PERMISSION] onchange', permissionStatus.state); // granted, denied, prompt
|
||||||
|
|
||||||
// If he has entered before, the saved access is already saved
|
// If he has entered before, the saved access is already saved
|
||||||
if (permissionStatus === 'grated') {
|
if (permissionStatus === 'grated') {
|
||||||
doIHaveAudio = true;
|
doIHaveAudio = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it is the first time client enter and give permission
|
// 🟨 [PERMISSION] onchange denied
|
||||||
permissionStatus.onchange = function() {
|
// If it is the first time client enter and give permission
|
||||||
console.log('🟨 [PERMISSION] onchange2', this.state);
|
permissionStatus.onchange = function() {
|
||||||
if (this.state === 'grated') {
|
console.log('🟨 [PERMISSION] onchange', this.state);
|
||||||
// doIHaveAudio = true;
|
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)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// 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 = () => {
|
||||||
@ -331,6 +375,7 @@ 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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user