From cac2caa5c0ea9ff4e13857bdc8e37212aebfd989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5var=20Aamb=C3=B8=20Fosstveit?= Date: Mon, 18 Jun 2018 11:06:39 +0200 Subject: [PATCH] Some small fixes to resolution and scaling. --- app/lib/RoomClient.js | 3 ++- app/lib/components/Peers.jsx | 17 ++++++++++------- app/stylus/components/PeerView.styl | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/lib/RoomClient.js b/app/lib/RoomClient.js index a791893..14a899c 100644 --- a/app/lib/RoomClient.js +++ b/app/lib/RoomClient.js @@ -20,7 +20,8 @@ const ROOM_OPTIONS = const VIDEO_CONSTRAINS = { - width : { ideal: 3840 } + width : { ideal: 1280 }, + aspectRatio : 1.334 }; export default class RoomClient diff --git a/app/lib/components/Peers.jsx b/app/lib/components/Peers.jsx index 229991e..33d74dc 100644 --- a/app/lib/components/Peers.jsx +++ b/app/lib/components/Peers.jsx @@ -18,12 +18,14 @@ class Peers extends React.Component }; } - updateDimensions(nextProps = null) + resizeUpdate() { - if (!nextProps.peers && !this.props.peers) - return; + this.updateDimensions(); + } - const n = nextProps ? nextProps.peers.length : this.props.peers.length; + updateDimensions(props = this.props) + { + const n = props.peers ? props.peers.length : 0; if (n == 0) { @@ -62,17 +64,18 @@ class Peers extends React.Component componentDidMount() { - window.addEventListener('resize', this.updateDimensions.bind(this)); + window.addEventListener('resize', this.resizeUpdate.bind(this)); } componentWillUnmount() { - window.removeEventListener('resize', this.updateDimensions.bind(this)); + window.removeEventListener('resize', this.resizeUpdate.bind(this)); } componentWillReceiveProps(nextProps) { - this.updateDimensions(nextProps); + if (nextProps.peers) + this.updateDimensions(nextProps); } render() diff --git a/app/stylus/components/PeerView.styl b/app/stylus/components/PeerView.styl index f5dbdc0..1230284 100644 --- a/app/stylus/components/PeerView.styl +++ b/app/stylus/components/PeerView.styl @@ -170,7 +170,7 @@ flex: 100 100 auto; height: 100%; width: 100%; - object-fit: contain; + object-fit: cover; user-select: none; transition-property: opacity; transition-duration: .15s;