aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Amoush <muhammedamoush@gmail.com>2019-12-08 16:12:16 -0500
committerMohammad Amoush <muhammedamoush@gmail.com>2019-12-08 16:12:16 -0500
commitf4382d73eec75f7d7f4bfe6eae3fb1efa128a021 (patch)
tree3df81209d85d56e84bf99c684552c75d66917afa
parent01c131e8d7ecc2eac68e16a679c40b1156b41391 (diff)
Local Stream tracks stopped when component gets closed
-rw-r--r--src/client/views/webcam/DashWebRTC.ts13
-rw-r--r--src/client/views/webcam/DashWebRTCVideo.tsx2
2 files changed, 6 insertions, 9 deletions
diff --git a/src/client/views/webcam/DashWebRTC.ts b/src/client/views/webcam/DashWebRTC.ts
index 195f1f0c4..6c7322a3d 100644
--- a/src/client/views/webcam/DashWebRTC.ts
+++ b/src/client/views/webcam/DashWebRTC.ts
@@ -116,13 +116,6 @@ export namespace DashWebRTC {
}
-
-
- //let socket = io.connect();
-
-
-
-
function sendMessage(message: any) {
console.log('Client sending message: ', message);
Utils.Emit(DocServer._socket, MessageStore.NotifyRoommates, { message: message, room: curRoom });
@@ -289,8 +282,10 @@ export namespace DashWebRTC {
stop();
sendMessage('bye');
}
- //stop local tracks on hang-up
- //localVideo.srcObject!.getTracks().forEach(track => track.stop());
+
+ if (localStream) {
+ localStream.getTracks().forEach(track => track.stop());
+ }
}
diff --git a/src/client/views/webcam/DashWebRTCVideo.tsx b/src/client/views/webcam/DashWebRTCVideo.tsx
index a763fd64c..a9c67f026 100644
--- a/src/client/views/webcam/DashWebRTCVideo.tsx
+++ b/src/client/views/webcam/DashWebRTCVideo.tsx
@@ -25,6 +25,7 @@ const offerOptions = {
offerToReceiveVideo: 1,
};
+
/**
* This models the component that will be rendered, that can be used as a doc that will reflect the video cams.
*/
@@ -57,6 +58,7 @@ export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentV
// DocumentDecorations.Instance.removeCloseCall(this.closeConnection);
}
+
// componentDidMount() {
// // DashWebRTC.setVideoObjects(this.localVideoEl!, this.peerVideoEl!);
// //DashWebRTC.init();