mirror of https://github.com/OpenVidu/openvidu.git
Audio-only also works if camera access is blocked but mic is allowed
parent
ea78653374
commit
1754101d52
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -374,6 +374,29 @@ export class Stream {
|
|||
private requestCameraAccesAux(constraints, callback) {
|
||||
navigator.mediaDevices.getUserMedia(constraints)
|
||||
.then(userStream => {
|
||||
this.cameraAccessSuccess(userStream, callback);
|
||||
})
|
||||
.catch(error => {
|
||||
// Try to ask for microphone only
|
||||
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
|
||||
.then(userStream => {
|
||||
constraints.video = false;
|
||||
this.sendVideo = false;
|
||||
this.audioOnly = true;
|
||||
this.cameraAccessSuccess(userStream, callback);
|
||||
})
|
||||
.catch(error => {
|
||||
this.accessIsDenied = true;
|
||||
this.accessIsAllowed = false;
|
||||
this.ee.emitEvent('access-denied-by-publisher');
|
||||
|
||||
console.error("Access denied", error);
|
||||
callback(error, this);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private cameraAccessSuccess(userStream, callback) {
|
||||
this.accessIsAllowed = true;
|
||||
this.accessIsDenied = false;
|
||||
this.ee.emitEvent('access-allowed-by-publisher');
|
||||
|
@ -389,15 +412,6 @@ export class Stream {
|
|||
this.emitSrcEvent(this.wrStream);
|
||||
|
||||
callback(undefined, this);
|
||||
})
|
||||
.catch(error => {
|
||||
this.accessIsDenied = true;
|
||||
this.accessIsAllowed = false;
|
||||
this.ee.emitEvent('access-denied-by-publisher');
|
||||
|
||||
console.error("Access denied", error);
|
||||
callback(error, this);
|
||||
});
|
||||
}
|
||||
|
||||
private userMediaHasVideo(callback) {
|
||||
|
|
Loading…
Reference in New Issue