Removing listeners from MediaManager.
SimplePeer now reacts only to stores.
This commit is contained in:
parent
5295f923b5
commit
b7f1461405
4 changed files with 90 additions and 150 deletions
|
@ -19,7 +19,7 @@ export class ScreenSharingPeer extends Peer {
|
|||
public _connected: boolean = false;
|
||||
private userId: number;
|
||||
|
||||
constructor(user: UserSimplePeerInterface, initiator: boolean, private connection: RoomConnection) {
|
||||
constructor(user: UserSimplePeerInterface, initiator: boolean, private connection: RoomConnection, stream: MediaStream | null) {
|
||||
super({
|
||||
initiator: initiator ? initiator : false,
|
||||
//reconnectTimer: 10000,
|
||||
|
@ -81,7 +81,9 @@ export class ScreenSharingPeer extends Peer {
|
|||
this._onFinish();
|
||||
});
|
||||
|
||||
this.pushScreenSharingToRemoteUser();
|
||||
if (stream) {
|
||||
this.addStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private sendWebrtcScreenSharingSignal(data: unknown) {
|
||||
|
@ -141,16 +143,6 @@ export class ScreenSharingPeer extends Peer {
|
|||
}
|
||||
}
|
||||
|
||||
private pushScreenSharingToRemoteUser() {
|
||||
const localScreenCapture: MediaStream | null = mediaManager.localScreenCapture;
|
||||
if(!localScreenCapture){
|
||||
return;
|
||||
}
|
||||
|
||||
this.addStream(localScreenCapture);
|
||||
return;
|
||||
}
|
||||
|
||||
public stopPushingScreenSharingToRemoteUser(stream: MediaStream) {
|
||||
this.removeStream(stream);
|
||||
this.write(new Buffer(JSON.stringify({type: MESSAGE_TYPE_CONSTRAINT, streamEnded: true})));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue