diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/webcam/DashWebRTC.ts | 44 | ||||
-rw-r--r-- | src/client/views/webcam/DashWebRTCVideo.tsx | 16 | ||||
-rw-r--r-- | src/server/index.ts | 4 |
3 files changed, 25 insertions, 39 deletions
diff --git a/src/client/views/webcam/DashWebRTC.ts b/src/client/views/webcam/DashWebRTC.ts index 801fd782d..bd0bd7f9a 100644 --- a/src/client/views/webcam/DashWebRTC.ts +++ b/src/client/views/webcam/DashWebRTC.ts @@ -1,7 +1,9 @@ import { DocServer } from '../../DocServer'; - +/** + * This namespace will have the code required to have functionality code for the usage of webRTC. + */ export namespace DashWebRTC { @@ -130,6 +132,14 @@ export namespace DashWebRTC { remoteVideo = remoteVideo; } + export function setLocalVideoObject(localVideoRef: HTMLVideoElement) { + localVideo = localVideoRef; + } + + export function setRemoteVideoObject(remoteVideoRef: HTMLVideoElement) { + remoteVideo = remoteVideoRef; + } + @@ -286,36 +296,4 @@ export namespace DashWebRTC { } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
\ No newline at end of file diff --git a/src/client/views/webcam/DashWebRTCVideo.tsx b/src/client/views/webcam/DashWebRTCVideo.tsx index 62efd9730..503b71569 100644 --- a/src/client/views/webcam/DashWebRTCVideo.tsx +++ b/src/client/views/webcam/DashWebRTCVideo.tsx @@ -21,7 +21,9 @@ 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. + */ @observer export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentViewProps & FieldViewProps> { @@ -37,7 +39,7 @@ export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentV private hangupButton: HTMLButtonElement | undefined; componentDidMount() { - DashWebRTC.setVideoObjects(this.localVideoEl!, this.peerVideoEl!); + // DashWebRTC.setVideoObjects(this.localVideoEl!, this.peerVideoEl!); DashWebRTC.init(); } @@ -317,8 +319,14 @@ export class DashWebRTCVideo extends React.Component<CollectionFreeFormDocumentV render() { let content = <div className="webcam-cont" style={{ width: "100%", height: "100%" }} onWheel={this.onPostWheel} onPointerDown={this.onPostPointer} onPointerMove={this.onPostPointer} onPointerUp={this.onPostPointer}> - <video id="localVideo" autoPlay playsInline ref={(e) => this.localVideoEl = e!}></video> - <video id="remoteVideo" autoPlay playsInline ref={(e) => this.peerVideoEl = e!}></video> + <video id="localVideo" autoPlay playsInline ref={(e) => { + this.localVideoEl = e!; + DashWebRTC.setLocalVideoObject(e!); + }}></video> + <video id="remoteVideo" autoPlay playsInline ref={(e) => { + this.peerVideoEl = e!; + DashWebRTC.setRemoteVideoObject(e!); + }}></video> {/* <button id="startButton" ref={(e) => this.startButton = e!} onClick={this.startAction}>Start</button> <button id="callButton" ref={(e) => this.callButton = e!} onClick={this.callAction}>Call</button> <button id="hangupButton" ref={(e) => this.hangupButton = e!} onClick={this.hangupAction}>Hang Up</button> */} diff --git a/src/server/index.ts b/src/server/index.ts index e33fd4b71..77f048a1e 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -983,8 +983,8 @@ function HandleYoutubeQuery([query, callback]: [YoutubeQueryInput, (result?: any } function HandleRoommateNotification(socket: Socket, message: RoomMessage) { - //socket.broadcast.emit('message', message); - server.sockets.in(message.room).emit('message', message.message); + socket.broadcast.emit('message', message); + //server.sockets.in(message.room).emit('message', message.message); } |