Fix to add special screen sharing
This commit is contained in:
parent
209057e3fc
commit
3e2c5049f2
@ -298,7 +298,11 @@ export class MediaManager {
|
|||||||
<video id="${userId}" autoplay></video>
|
<video id="${userId}" autoplay></video>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
this.remoteVideo.set(userId, document.getElementById(userId));
|
let activeHTMLVideoElement : HTMLElement|null = document.getElementById(userId);
|
||||||
|
if(!activeHTMLVideoElement){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.remoteVideo.set(userId, (activeHTMLVideoElement as HTMLVideoElement));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,9 +122,11 @@ export class SimplePeer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let screenSharing : boolean = name !== undefined && name.indexOf("screenSharing") > -1;
|
let screenSharing : boolean = name !== undefined && name.indexOf("screenSharing") > -1;
|
||||||
|
mediaManager.removeActiveVideo(user.userId);
|
||||||
if(!screenSharing) {
|
if(!screenSharing) {
|
||||||
mediaManager.removeActiveVideo(user.userId);
|
|
||||||
mediaManager.addActiveVideo(user.userId, name);
|
mediaManager.addActiveVideo(user.userId, name);
|
||||||
|
}else{
|
||||||
|
mediaManager.addScreenSharingActiveVideo(user.userId, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const peer : SimplePeerNamespace.Instance = new Peer({
|
const peer : SimplePeerNamespace.Instance = new Peer({
|
||||||
@ -151,22 +153,6 @@ export class SimplePeer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
peer.on('stream', (stream: MediaStream) => {
|
peer.on('stream', (stream: MediaStream) => {
|
||||||
if(screenSharing){
|
|
||||||
//add stream video on
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let videoActive = false;
|
|
||||||
let microphoneActive = false;
|
|
||||||
stream.getTracks().forEach((track : MediaStreamTrack) => {
|
|
||||||
if(track.kind === "audio"){
|
|
||||||
microphoneActive = true;
|
|
||||||
}
|
|
||||||
if(track.kind === "video"){
|
|
||||||
videoActive = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.stream(user.userId, stream);
|
this.stream(user.userId, stream);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user