Refactoring parameters passed to ScreenSharingPeer
This commit is contained in:
parent
cdb3cfdc81
commit
12ef2820bf
@ -3,6 +3,7 @@ import {mediaManager} from "./MediaManager";
|
|||||||
import {STUN_SERVER, TURN_SERVER, TURN_USER, TURN_PASSWORD} from "../Enum/EnvironmentVariable";
|
import {STUN_SERVER, TURN_SERVER, TURN_USER, TURN_PASSWORD} from "../Enum/EnvironmentVariable";
|
||||||
import {RoomConnection} from "../Connexion/RoomConnection";
|
import {RoomConnection} from "../Connexion/RoomConnection";
|
||||||
import {MESSAGE_TYPE_CONSTRAINT} from "./VideoPeer";
|
import {MESSAGE_TYPE_CONSTRAINT} from "./VideoPeer";
|
||||||
|
import {UserSimplePeerInterface} from "./SimplePeer";
|
||||||
|
|
||||||
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
||||||
|
|
||||||
@ -16,8 +17,9 @@ export class ScreenSharingPeer extends Peer {
|
|||||||
private isReceivingStream:boolean = false;
|
private isReceivingStream:boolean = false;
|
||||||
public toClose: boolean = false;
|
public toClose: boolean = false;
|
||||||
public _connected: boolean = false;
|
public _connected: boolean = false;
|
||||||
|
private userId: number;
|
||||||
|
|
||||||
constructor(private userId: number, initiator: boolean, private connection: RoomConnection, webRtcUser: string | undefined, webRtcPassword: string | undefined) {
|
constructor(user: UserSimplePeerInterface, initiator: boolean, private connection: RoomConnection) {
|
||||||
super({
|
super({
|
||||||
initiator: initiator ? initiator : false,
|
initiator: initiator ? initiator : false,
|
||||||
reconnectTimer: 10000,
|
reconnectTimer: 10000,
|
||||||
@ -28,13 +30,15 @@ export class ScreenSharingPeer extends Peer {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
urls: TURN_SERVER.split(','),
|
urls: TURN_SERVER.split(','),
|
||||||
username: webRtcUser || TURN_USER,
|
username: user.webRtcUser || TURN_USER,
|
||||||
credential: webRtcPassword || TURN_PASSWORD
|
credential: user.webRtcPassword || TURN_PASSWORD
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.userId = user.userId;
|
||||||
|
|
||||||
//start listen signal for the peer connection
|
//start listen signal for the peer connection
|
||||||
this.on('signal', (data: unknown) => {
|
this.on('signal', (data: unknown) => {
|
||||||
this.sendWebrtcScreenSharingSignal(data);
|
this.sendWebrtcScreenSharingSignal(data);
|
||||||
|
@ -191,7 +191,7 @@ export class SimplePeer {
|
|||||||
mediaManager.addScreenSharingActiveVideo("" + user.userId);
|
mediaManager.addScreenSharingActiveVideo("" + user.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const peer = new ScreenSharingPeer(user.userId, user.initiator ? user.initiator : false, this.Connection, user.webRtcUser, user.webRtcPassword);
|
const peer = new ScreenSharingPeer(user, user.initiator ? user.initiator : false, this.Connection);
|
||||||
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
||||||
|
|
||||||
for (const peerConnectionListener of this.peerConnectionListeners) {
|
for (const peerConnectionListener of this.peerConnectionListeners) {
|
||||||
|
Loading…
Reference in New Issue
Block a user