Adding a scene to configure the webcam
This commit is contained in:
parent
617ff45bfa
commit
3de37bafed
10 changed files with 537 additions and 5 deletions
|
@ -6,7 +6,9 @@ const videoConstraint: boolean|MediaTrackConstraints = {
|
|||
|
||||
type UpdatedLocalStreamCallback = (media: MediaStream) => void;
|
||||
|
||||
class MediaManager {
|
||||
// TODO: Split MediaManager in 2 classes: MediaManagerUI (in charge of HTML) and MediaManager (singleton in charge of the camera only)
|
||||
// TODO: verify that microphone event listeners are not triggered plenty of time NOW (since MediaManager is created many times!!!!)
|
||||
export class MediaManager {
|
||||
localStream: MediaStream|null = null;
|
||||
private remoteVideo: Map<string, HTMLVideoElement> = new Map<string, HTMLVideoElement>();
|
||||
myCamVideo: HTMLVideoElement;
|
||||
|
@ -154,6 +156,26 @@ class MediaManager {
|
|||
return promise;
|
||||
}
|
||||
|
||||
setCamera(id: string): Promise<MediaStream> {
|
||||
let video = this.constraintsMedia.video;
|
||||
if (typeof(video) === 'boolean' || video === undefined) {
|
||||
video = {}
|
||||
}
|
||||
video.deviceId = id;
|
||||
|
||||
return this.getCamera();
|
||||
}
|
||||
|
||||
setMicrophone(id: string): Promise<MediaStream> {
|
||||
let audio = this.constraintsMedia.audio;
|
||||
if (typeof(audio) === 'boolean' || audio === undefined) {
|
||||
audio = {}
|
||||
}
|
||||
audio.deviceId = id;
|
||||
|
||||
return this.getCamera();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userId
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue