Continue screen sharing
This commit is contained in:
parent
3e2c5049f2
commit
0bbed7717a
5
front/dist/index.html
vendored
5
front/dist/index.html
vendored
@ -108,12 +108,11 @@
|
|||||||
<img id="monitor" src="resources/logos/monitor.svg">
|
<img id="monitor" src="resources/logos/monitor.svg">
|
||||||
<img id="monitor-close" src="resources/logos/monitor-close.svg">
|
<img id="monitor-close" src="resources/logos/monitor-close.svg">
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="btn-call">
|
|
||||||
<img src="resources/logos/phone.svg">
|
|
||||||
</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
<div id="activeScreenSharing" class="active-screen-sharing active">
|
||||||
|
</div>
|
||||||
<div id="webRtcSetup" class="webrtcsetup">
|
<div id="webRtcSetup" class="webrtcsetup">
|
||||||
<img id="webRtcSetupNoVideo" class="background-img" src="resources/logos/cinema-close.svg">
|
<img id="webRtcSetupNoVideo" class="background-img" src="resources/logos/cinema-close.svg">
|
||||||
<video id="myCamVideoSetup" autoplay muted></video>
|
<video id="myCamVideoSetup" autoplay muted></video>
|
||||||
|
30
front/dist/resources/style/style.css
vendored
30
front/dist/resources/style/style.css
vendored
@ -365,3 +365,33 @@ body {
|
|||||||
.chat-mode > div:last-child {
|
.chat-mode > div:last-child {
|
||||||
flex-grow: 5;
|
flex-grow: 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*SCREEN SHARING*/
|
||||||
|
.active-screen-sharing video{
|
||||||
|
transform: scaleX(1);
|
||||||
|
}
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video:hover{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video{
|
||||||
|
position: absolute;
|
||||||
|
width: 25%;
|
||||||
|
height: auto;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video:nth-child(1){
|
||||||
|
/*this is for camera of user*/
|
||||||
|
top: 0%;
|
||||||
|
}
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video:nth-child(2){
|
||||||
|
top: 25%;
|
||||||
|
}
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video:nth-child(3){
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
.active-screen-sharing .screen-sharing-video-container video:nth-child(4) {
|
||||||
|
top: 75%;
|
||||||
|
}
|
||||||
|
@ -289,14 +289,22 @@ export class SimplePeer {
|
|||||||
*/
|
*/
|
||||||
private addMedia (userId : string) {
|
private addMedia (userId : string) {
|
||||||
try {
|
try {
|
||||||
let localStream: MediaStream | null = mediaManager.localStream;
|
|
||||||
let localScreenCapture: MediaStream | null = mediaManager.localScreenCapture;
|
|
||||||
let PeerConnection = this.PeerConnectionArray.get(userId);
|
let PeerConnection = this.PeerConnectionArray.get(userId);
|
||||||
|
if (!PeerConnection) {
|
||||||
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}))));
|
|
||||||
|
if(userId.indexOf("screenSharing") > -1 && mediaManager.localScreenCapture){
|
||||||
|
for (const track of mediaManager.localScreenCapture.getTracks()) {
|
||||||
|
PeerConnection.addTrack(track, mediaManager.localScreenCapture);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let localStream: MediaStream | null = mediaManager.localStream;
|
||||||
|
let localScreenCapture: MediaStream | null = mediaManager.localScreenCapture;
|
||||||
|
|
||||||
|
PeerConnection.write(new Buffer(JSON.stringify(Object.assign(this.MediaManager.constraintsMedia, {screen: localScreenCapture !== null}))));
|
||||||
|
|
||||||
if(!localStream){
|
if(!localStream){
|
||||||
return;
|
return;
|
||||||
@ -321,15 +329,21 @@ export class SimplePeer {
|
|||||||
if (this.MediaManager.localScreenCapture) {
|
if (this.MediaManager.localScreenCapture) {
|
||||||
let screenSharingUser: UserSimplePeerInterface = {
|
let screenSharingUser: UserSimplePeerInterface = {
|
||||||
userId: `screenSharing-${this.Connection.userId}`,
|
userId: `screenSharing-${this.Connection.userId}`,
|
||||||
|
name: 'screenSharing',
|
||||||
initiator: true
|
initiator: true
|
||||||
};
|
};
|
||||||
let PeerConnectionScreenSharing = this.createPeerConnection(screenSharingUser);
|
let PeerConnectionScreenSharing = this.createPeerConnection(screenSharingUser);
|
||||||
if (!PeerConnectionScreenSharing) {
|
if (!PeerConnectionScreenSharing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
for (const track of this.MediaManager.localScreenCapture.getTracks()) {
|
for (const track of this.MediaManager.localScreenCapture.getTracks()) {
|
||||||
PeerConnectionScreenSharing.addTrack(track, this.MediaManager.localScreenCapture);
|
PeerConnectionScreenSharing.addTrack(track, this.MediaManager.localScreenCapture);
|
||||||
}
|
}
|
||||||
|
}catch (e) {
|
||||||
|
console.error("updatedScreenSharing => ", e);
|
||||||
|
}
|
||||||
|
this.MediaManager.addStreamRemoteVideo(screenSharingUser.userId, this.MediaManager.localScreenCapture);
|
||||||
} else {
|
} else {
|
||||||
if (!this.PeerConnectionArray.has(`screenSharing-${this.Connection.userId}`)) {
|
if (!this.PeerConnectionArray.has(`screenSharing-${this.Connection.userId}`)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user