From 38d0d467ee4c27709d482bfea7505e3f3729a455 Mon Sep 17 00:00:00 2001 From: Mohammad Amoush <47069173+mamoush34@users.noreply.github.com> Date: Sat, 8 Feb 2020 13:23:00 -0500 Subject: Ui Update and stream track stoppage added --- src/client/views/webcam/DashWebRTCVideo.scss | 30 +++++------ src/client/views/webcam/DashWebRTCVideo.tsx | 50 ++++++++++--------- src/client/views/webcam/WebCamLogic.js | 75 ++++++++++++++++------------ src/server/Websocket/Websocket.ts | 16 +++--- 4 files changed, 93 insertions(+), 78 deletions(-) (limited to 'src') diff --git a/src/client/views/webcam/DashWebRTCVideo.scss b/src/client/views/webcam/DashWebRTCVideo.scss index 262528d8e..052832db5 100644 --- a/src/client/views/webcam/DashWebRTCVideo.scss +++ b/src/client/views/webcam/DashWebRTCVideo.scss @@ -27,14 +27,14 @@ border: 1px solid #BBBBBBBB; } - #localVideo { - width: 50%; - height: 50%; - position: relative; - // top: 65%; - // z-index: 2; - // right: 5%; - } + // #localVideo { + // width: 50%; + // height: 50%; + // position: relative; + // // top: 65%; + // // z-index: 2; + // // right: 5%; + // } .side { width: 25%; @@ -53,12 +53,12 @@ align-self: center; } - #remoteVideo { - position: relative; - width: 50%; - height: 50%; - // top: 20%; - // align-self: center; - } + // #remoteVideo { + // position: relative; + // width: 50%; + // height: 50%; + // // top: 20%; + // // align-self: center; + // } } \ No newline at end of file diff --git a/src/client/views/webcam/DashWebRTCVideo.tsx b/src/client/views/webcam/DashWebRTCVideo.tsx index 191f5750d..f93d4a662 100644 --- a/src/client/views/webcam/DashWebRTCVideo.tsx +++ b/src/client/views/webcam/DashWebRTCVideo.tsx @@ -12,7 +12,7 @@ import { DocServer } from "../../DocServer"; import { DocumentView } from "../nodes/DocumentView"; import { Utils } from "../../../Utils"; import { MessageStore } from "../../../server/Message"; -import { initialize } from "./WebCamLogic"; +import { initialize, hangup } from "./WebCamLogic"; const mediaStreamConstraints = { video: true, @@ -29,12 +29,12 @@ const offerOptions = { export class DashWebRTCVideo extends React.Component { @observable private localVideoEl: HTMLVideoElement | undefined; @observable private peerVideoEl: HTMLVideoElement | undefined; - // private roomText: HTMLInputElement | undefined; + private roomText: HTMLInputElement | undefined; // private roomOfCam: string = ""; // private isChannelReady = false; // private isInitiator = false; // private isStarted = false; - // @observable remoteVideoAdded: boolean = false; + @observable remoteVideoAdded: boolean = false; // localStream: MediaStream | undefined; // private pc: any; // remoteStream: MediaStream | undefined; @@ -56,17 +56,22 @@ export class DashWebRTCVideo extends React.Component initialize(), 10000); + DocumentDecorations.Instance.addCloseCall(this.closeConnection); + // setTimeout(() => initialize(), 10000); // let self = this; // window.onbeforeunload = function () { // self.sendMessage('bye'); // }; } - // closeConnection: CloseCall = () => { - // this.hangup(); - // } + closeConnection: CloseCall = () => { + hangup(); + } + + @action + changeUILook = () => { + this.remoteVideoAdded = true; + } // componentWillUnmount() { // } @@ -335,18 +340,17 @@ export class DashWebRTCVideo extends React.Component { - // if (e.keyCode === 13) { - // let submittedTitle = this.roomText!.value; - // this.roomText!.value = ""; - // this.roomText!.blur(); - // this.roomOfCam = submittedTitle; - // this.init(submittedTitle); - // } - // } + /** + * Function that submits the title entered by user on enter press. + */ + private onEnterKeyDown = (e: React.KeyboardEvent) => { + if (e.keyCode === 13) { + let submittedTitle = this.roomText!.value; + this.roomText!.value = ""; + this.roomText!.blur(); + initialize(submittedTitle, this.changeUILook); + } + } public static LayoutString(fieldKey: string) { return FieldView.LayoutString(DashWebRTCVideo, fieldKey); } @@ -373,11 +377,11 @@ export class DashWebRTCVideo extends React.Component
DashWebRTC
- {/* this.roomText = e!} onKeyDown={this.onEnterKeyDown} /> */} -