LH-265-enable-audio-in-mediasoup #16
@ -20512,6 +20512,33 @@ const streamSuccess = (stream) => {
|
||||
|
||||
const getLocalStream = () => {
|
||||
console.log('[getLocalStream]');
|
||||
|
||||
try {
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('eeeeee', error);
|
||||
}
|
||||
|
||||
|
||||
navigator.mediaDevices.getUserMedia({
|
||||
audio: true,
|
||||
video: {
|
||||
@ -20521,30 +20548,7 @@ const getLocalStream = () => {
|
||||
}
|
||||
})
|
||||
.then((streamSuccess) => {
|
||||
try {
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('eeeeee', error);
|
||||
}
|
||||
|
||||
return streamSuccess
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -154,6 +154,33 @@ const streamSuccess = (stream) => {
|
||||
|
||||
const getLocalStream = () => {
|
||||
console.log('[getLocalStream]');
|
||||
|
||||
try {
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('eeeeee', error);
|
||||
}
|
||||
|
||||
|
||||
navigator.mediaDevices.getUserMedia({
|
||||
audio: true,
|
||||
video: {
|
||||
@ -163,30 +190,7 @@ const getLocalStream = () => {
|
||||
}
|
||||
})
|
||||
.then((streamSuccess) => {
|
||||
try {
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('eeeeee', error);
|
||||
}
|
||||
|
||||
return streamSuccess
|
||||
})
|
||||
.catch(error => {
|
||||
|
Loading…
Reference in New Issue
Block a user