aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/webcam
diff options
context:
space:
mode:
authorMohammad Amoush <muhammedamoush@gmail.com>2019-12-07 16:57:51 -0500
committerMohammad Amoush <muhammedamoush@gmail.com>2019-12-07 16:57:51 -0500
commit01c131e8d7ecc2eac68e16a679c40b1156b41391 (patch)
tree6b35ba68c75979170bc4a14e8147157b8a7140ca /src/client/views/webcam
parent40c40d377ec169b44e1a9691129e5c7a6b0b10e4 (diff)
Adding hang-up functionality
Diffstat (limited to 'src/client/views/webcam')
-rw-r--r--src/client/views/webcam/DashWebRTC.ts11
-rw-r--r--src/client/views/webcam/DashWebRTCVideo.tsx20
2 files changed, 27 insertions, 4 deletions
diff --git a/src/client/views/webcam/DashWebRTC.ts b/src/client/views/webcam/DashWebRTC.ts
index c61469cb8..195f1f0c4 100644
--- a/src/client/views/webcam/DashWebRTC.ts
+++ b/src/client/views/webcam/DashWebRTC.ts
@@ -283,10 +283,15 @@ export namespace DashWebRTC {
console.log('Remote stream removed. Event: ', event);
}
- function hangup() {
+ export function hangup() {
console.log('Hanging up.');
- stop();
- sendMessage('bye');
+ if (pc) {
+ stop();
+ sendMessage('bye');
+ }
+ //stop local tracks on hang-up
+ //localVideo.srcObject!.getTracks().forEach(track => track.stop());
+
}
function handleRemoteHangup() {
diff --git a/src/client/views/webcam/DashWebRTCVideo.tsx b/src/client/views/webcam/DashWebRTCVideo.tsx
index 0c4e594e4..a763fd64c 100644
--- a/src/client/views/webcam/DashWebRTCVideo.tsx
+++ b/src/client/views/webcam/DashWebRTCVideo.tsx
@@ -3,13 +3,16 @@ import React = require("react");
import { CollectionFreeFormDocumentViewProps } from "../nodes/CollectionFreeFormDocumentView";
import { FieldViewProps, FieldView } from "../nodes/FieldView";
import { observable } from "mobx";
-import { DocumentDecorations } from "../DocumentDecorations";
+import { DocumentDecorations, CloseCall } from "../DocumentDecorations";
import { InkingControl } from "../InkingControl";
import "../../views/nodes/WebBox.scss";
import "./DashWebRTC.scss";
import adapter from 'webrtc-adapter';
import { DashWebRTC } from "./DashWebRTC";
import { DocServer } from "../../DocServer";
+import { DocumentView } from "../nodes/DocumentView";
+import { Utils } from "../../../Utils";
+import { MessageStore } from "../../../server/Message";
@@ -39,6 +42,20 @@ export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentV
private startButton: HTMLButtonElement | undefined;
private hangupButton: HTMLButtonElement | undefined;
private roomText: HTMLInputElement | undefined;
+ private roomOfCam: string = "";
+
+ componentDidMount() {
+ DocumentDecorations.Instance.addCloseCall(this.closeConnection);
+ }
+
+ closeConnection: CloseCall = () => {
+ //Utils.Emit(DocServer._socket, MessageStore.NotifyRoommates, { message: 'bye', room: this.roomOfCam });
+ DashWebRTC.hangup();
+ }
+
+ componentWillUnmount() {
+ // DocumentDecorations.Instance.removeCloseCall(this.closeConnection);
+ }
// componentDidMount() {
// // DashWebRTC.setVideoObjects(this.localVideoEl!, this.peerVideoEl!);
@@ -289,6 +306,7 @@ export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentV
let submittedTitle = this.roomText!.value;
this.roomText!.value = "";
this.roomText!.blur();
+ this.roomOfCam = submittedTitle;
DashWebRTC.init(submittedTitle);
}
}