MediaManager cleanup

- Removing the last reference to the local video stream. Everything is now fetched from the store.
- Remvoing commented code
This commit is contained in:
David Négrier
2021-05-29 22:34:38 +02:00
parent 4077db37e3
commit 90176da888
3 changed files with 22 additions and 54 deletions
+3 -4
View File
@@ -27,7 +27,7 @@ export class VideoPeer extends Peer {
private onBlockSubscribe: Subscription;
private onUnBlockSubscribe: Subscription;
constructor(public user: UserSimplePeerInterface, initiator: boolean, private connection: RoomConnection) {
constructor(public user: UserSimplePeerInterface, initiator: boolean, private connection: RoomConnection, localStream: MediaStream | null) {
super({
initiator: initiator ? initiator : false,
//reconnectTimer: 10000,
@@ -107,7 +107,7 @@ export class VideoPeer extends Peer {
this._onFinish();
});
this.pushVideoToRemoteUser();
this.pushVideoToRemoteUser(localStream);
this.onBlockSubscribe = blackListManager.onBlockStream.subscribe((userId) => {
if (userId === this.userId) {
this.toggleRemoteStream(false);
@@ -190,9 +190,8 @@ export class VideoPeer extends Peer {
}
}
private pushVideoToRemoteUser() {
private pushVideoToRemoteUser(localStream: MediaStream | null) {
try {
const localStream: MediaStream | null = mediaManager.localStream;
this.write(new Buffer(JSON.stringify({type: MESSAGE_TYPE_CONSTRAINT, ...get(obtainedMediaConstraintStore)})));
if(!localStream){