Camera now show up when someone is moving and hides 5 seconds after we stop moving.

Also, added an animation to show/hide the webcam.
This commit is contained in:
David Négrier 2021-05-20 18:05:03 +02:00
parent 8af8ccd54b
commit d32df13f1b
6 changed files with 146 additions and 10 deletions

View file

@ -142,15 +142,15 @@ export class MediaManager {
}
if (result.constraints.video !== false) {
this.enableCameraStyle();
HtmlUtils.getElementByIdOrFail('div-myCamVideo').classList.remove('hide');
} else {
this.disableCameraStyle();
}
HtmlUtils.getElementByIdOrFail('div-myCamVideo').classList.add('hide');
}/*
if (result.constraints.audio !== false) {
this.enableMicrophoneStyle();
} else {
this.disableMicrophoneStyle();
}
}*/
this.localStream = result.stream;
this.myCamVideo.srcObject = this.localStream;
@ -158,6 +158,21 @@ export class MediaManager {
// TODO: migrate all listeners to the store directly.
this.triggerUpdatedLocalStreamCallbacks(result.stream);
});
requestedCameraState.subscribe((enabled) => {
if (enabled) {
this.enableCameraStyle();
} else {
this.disableCameraStyle();
}
});
requestedMicrophoneState.subscribe((enabled) => {
if (enabled) {
this.enableMicrophoneStyle();
} else {
this.disableMicrophoneStyle();
}
});
}
public updateScene(){