Fix CI
This commit is contained in:
parent
eed5333d69
commit
6c1b8122ef
@ -294,23 +294,13 @@ export class SimplePeer {
|
|||||||
try {
|
try {
|
||||||
let localStream: MediaStream | null = mediaManager.localStream;
|
let localStream: MediaStream | null = mediaManager.localStream;
|
||||||
let localScreenCapture: MediaStream | null = mediaManager.localScreenCapture;
|
let localScreenCapture: MediaStream | null = mediaManager.localScreenCapture;
|
||||||
let PeerConnection : any = this.PeerConnectionArray.get(userId);
|
let PeerConnection = this.PeerConnectionArray.get(userId);
|
||||||
if (PeerConnection === undefined) {
|
|
||||||
|
if (!PeerConnection || PeerConnection === undefined) {
|
||||||
throw new Error('While adding media, cannot find user with ID ' + userId);
|
throw new Error('While adding media, cannot find user with ID ' + userId);
|
||||||
}
|
}
|
||||||
PeerConnection.write(new Buffer(JSON.stringify(Object.assign(mediaManager.constraintsMedia, {screen: localScreenCapture !== null}))));
|
PeerConnection.write(new Buffer(JSON.stringify(Object.assign(mediaManager.constraintsMedia, {screen: localScreenCapture !== null}))));
|
||||||
|
|
||||||
//remove current stream
|
|
||||||
try {
|
|
||||||
if (PeerConnection._pc) {
|
|
||||||
PeerConnection._pc.getRemoteStreams().forEach((stream: MediaStream) => {
|
|
||||||
stream.getTracks().forEach((track: MediaStreamTrack) => {
|
|
||||||
PeerConnection.removeTrack(track, stream);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}catch (e) {}
|
|
||||||
|
|
||||||
if (localScreenCapture !== null) {
|
if (localScreenCapture !== null) {
|
||||||
for (const track of localScreenCapture.getTracks()) {
|
for (const track of localScreenCapture.getTracks()) {
|
||||||
PeerConnection.addTrack(track, localScreenCapture);
|
PeerConnection.addTrack(track, localScreenCapture);
|
||||||
|
Loading…
Reference in New Issue
Block a user