From 2645dc619abcf57a2cea42a4496110320f032fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 27 Apr 2017 22:58:23 +0200 Subject: [PATCH] Show remote audio levels --- app/lib/Client.js | 14 ++++++- app/lib/components/LocalVideo.jsx | 9 +++- app/lib/components/RemoteVideo.jsx | 16 +++++--- app/lib/components/Room.jsx | 21 ++++++++-- app/lib/components/Video.jsx | 4 +- app/stylus/components/LocalVideo.styl | 6 ++- app/stylus/components/RemoteVideo.styl | 4 ++ app/stylus/components/Video.styl | 2 +- server/lib/Room.js | 57 ++++++++++++++++++++++++++ 9 files changed, 118 insertions(+), 15 deletions(-) diff --git a/app/lib/Client.js b/app/lib/Client.js index 5f1c056..d9d8453 100644 --- a/app/lib/Client.js +++ b/app/lib/Client.js @@ -28,6 +28,9 @@ export default class Client extends events.EventEmitter super(); this.setMaxListeners(Infinity); + // TODO: TMP + global.CLIENT = this; + let url = urlFactory.getProtooUrl(peerId, roomId); let transport = new protooClient.WebSocketTransport(url); @@ -708,6 +711,16 @@ export default class Client extends events.EventEmitter break; } + case 'activespeaker': + { + let data = request.data; + + this.emit('activespeaker', data.peer, data.level); + accept(); + + break; + } + default: { logger.error('unknown method'); @@ -776,7 +789,6 @@ export default class Client extends events.EventEmitter this._peerconnection = new RTCPeerConnection({ iceServers: [] }); // TODO: TMP - global.CLIENT = this; global.PC = this._peerconnection; if (this._localStream) diff --git a/app/lib/components/LocalVideo.jsx b/app/lib/components/LocalVideo.jsx index 9370a40..9b23d23 100644 --- a/app/lib/components/LocalVideo.jsx +++ b/app/lib/components/LocalVideo.jsx @@ -5,6 +5,7 @@ import IconButton from 'material-ui/IconButton/IconButton'; import MicOffIcon from 'material-ui/svg-icons/av/mic-off'; import VideoCamOffIcon from 'material-ui/svg-icons/av/videocam-off'; import ChangeVideoCamIcon from 'material-ui/svg-icons/av/repeat'; +import classnames from 'classnames'; import Video from './Video'; import Logger from '../Logger'; @@ -30,7 +31,12 @@ export default class LocalVideo extends React.Component let state = this.state; return ( -
+
{props.stream ?