From 97b976b171ae228f5b37fdaac6afad4c432e0589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sat, 12 Jun 2021 08:15:26 +0200 Subject: [PATCH] Adjust for sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- res/css/views/voip/_VideoFeed.scss | 23 +----- src/components/views/voip/CallView.tsx | 97 ++++++++++++------------- src/components/views/voip/VideoFeed.tsx | 6 +- 3 files changed, 53 insertions(+), 73 deletions(-) diff --git a/res/css/views/voip/_VideoFeed.scss b/res/css/views/voip/_VideoFeed.scss index 3d39735519..fdc0ca2e7d 100644 --- a/res/css/views/voip/_VideoFeed.scss +++ b/res/css/views/voip/_VideoFeed.scss @@ -32,33 +32,16 @@ limitations under the License. } } -.mx_VideoFeed_nonPrimary { - max-width: 25%; - max-height: 25%; - position: absolute; - z-index: 100; +.mx_VideoFeed_secondary { border-radius: 4px; + width: 100%; + margin-bottom: 12px; &.mx_VideoFeed_video { background-color: transparent; } } -.mx_VideoFeed_secondary { - right: 10px; - top: 10px; -} - -.mx_VideoFeed_tertiary { - right: 10px; - bottom: 10px; -} - -.mx_VideoFeed_quaternary { - left: 10px; - top: 10px; -} - .mx_VideoFeed_mirror { transform: scale(-1, 1); } diff --git a/src/components/views/voip/CallView.tsx b/src/components/views/voip/CallView.tsx index a9d605c9f1..d40674e4a6 100644 --- a/src/components/views/voip/CallView.tsx +++ b/src/components/views/voip/CallView.tsx @@ -35,13 +35,7 @@ import {replaceableComponent} from "../../../utils/replaceableComponent"; import DesktopCapturerSourcePicker from "../elements/DesktopCapturerSourcePicker"; import Modal from '../../../Modal'; import { SDPStreamMetadataPurpose } from 'matrix-js-sdk/src/webrtc/callEventTypes'; - -const FEED_CLASS_NAMES = [ - "mx_VideoFeed_primary", - "mx_VideoFeed_secondary", - "mx_VideoFeed_tertiary", - "mx_VideoFeed_quaternary", -]; +import CallViewSidebar from './CallViewSidebar'; interface IProps { // The call for us to display @@ -404,29 +398,6 @@ export default class CallView extends React.Component { this.props.call.transferToCall(transfereeCall); } - private renderFeeds(feeds: Array, offset = 0) { - return feeds.map((feed, i) => { - i += offset; - // TODO: Later the CallView should probably be reworked to support - // any number of feeds but now we can't render more than 4 feeds - if (i >= 4) return; - // Here we check to hide any non-main audio feeds from the UI - // This is because we don't want them to obstruct the view - // But once again this might be subject to change - if (feed.isVideoMuted() && i > 0) return; - return ( - - ); - }); - } - public render() { const client = MatrixClientPeg.get(); const callRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call); @@ -674,37 +645,63 @@ export default class CallView extends React.Component { mx_CallView_voice: true, }); - // We pass offset of one to avoid a feed being rendered as primary - const feeds = this.renderFeeds(this.props.call.getLocalFeeds(), 1); - // Saying "Connecting" here isn't really true, but the best thing // I can come up with, but this might be subject to change as well - contentView =
- {feeds} -
-
- + contentView = ( +
+ +
+
+ +
+
{_t("Connecting")}
+ {callControls}
-
{_t("Connecting")}
- {callControls} -
; + ); } else { const containerClasses = classNames({ mx_CallView_content: true, mx_CallView_video: true, }); - const feeds = this.renderFeeds(this.state.feeds); + // Don't show the primary feed in the sidebar + const feedsForSidebar = [...this.state.feeds]; + feedsForSidebar.shift(); - contentView =
- {feeds} - {callControls} -
; + contentView = ( +
+ + + { callControls } +
+ ); } const callTypeText = this.props.call.type === CallType.Video ? _t("Video Call") : _t("Voice Call"); diff --git a/src/components/views/voip/VideoFeed.tsx b/src/components/views/voip/VideoFeed.tsx index 48cad618eb..9e9fbeb810 100644 --- a/src/components/views/voip/VideoFeed.tsx +++ b/src/components/views/voip/VideoFeed.tsx @@ -38,7 +38,7 @@ interface IProps { // due to a change in video metadata onResize?: (e: Event) => void, - className: string, + primary: boolean, } interface IState { @@ -123,8 +123,8 @@ export default class VideoFeed extends React.Component { render() { const videoClasses = { mx_VideoFeed: true, - mx_VideoFeed_nonPrimary: this.props.className !== "mx_VideoFeed_primary", - [this.props.className]: true, + mx_VideoFeed_primary: this.props.primary, + mx_VideoFeed_secondary: !this.props.primary, mx_VideoFeed_voice: this.state.videoMuted, mx_VideoFeed_video: !this.state.videoMuted, mx_VideoFeed_mirror: (