Files
element-call/src/video-grid/VideoTile.module.css
2023-11-20 19:04:53 -05:00

201 lines
4.1 KiB
CSS

/*
Copyright 2022 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
.videoTile {
position: absolute;
contain: strict;
top: 0;
container-name: videoTile;
container-type: size;
border-radius: var(--cpd-space-4x);
overflow: hidden;
cursor: pointer;
outline: 2px solid rgba(0, 0, 0, 0);
transition:
outline-radius ease 0.15s,
outline-color ease 0.15s;
}
.videoTile * {
user-select: none;
}
.videoTile video {
width: 100%;
height: 100%;
object-fit: cover;
background-color: var(--cpd-color-bg-subtle-primary);
}
.videoTile.isLocal:not(.screenshare) video {
transform: scaleX(-1);
}
.videoTile.speaking {
/* !important because speaking border should take priority over hover */
outline: 4px solid var(--cpd-color-border-accent) !important;
}
@media (hover: hover) {
.videoTile:hover {
outline: 2px solid var(--cpd-color-gray-1400);
}
}
.videoTile.maximised {
position: relative;
border-radius: 0;
height: 100%;
width: 100%;
}
.videoTile.screenshare > video {
object-fit: contain;
}
.nameTag {
position: absolute;
inset-inline-start: var(--cpd-space-1x);
inset-block-end: var(--cpd-space-1x);
padding: var(--cpd-space-1x);
padding-block: var(--cpd-space-1x);
color: var(--cpd-color-text-primary);
background-color: var(--cpd-color-bg-canvas-default);
display: flex;
align-items: center;
border-radius: var(--cpd-radius-pill-effect);
user-select: none;
max-width: calc(100% - 48px);
overflow: hidden;
z-index: 1;
box-shadow: var(--small-drop-shadow);
}
.nameTag > svg {
flex-shrink: 0;
}
.muteIcon[data-muted="true"] {
color: var(--cpd-color-icon-secondary);
}
.muteIcon[data-muted="false"] {
color: var(--cpd-color-icon-primary);
}
.nameTag span {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
padding-inline: var(--cpd-space-2x);
}
.errorIcon {
color: var(--cpd-color-icon-critical-primary);
}
.toolbar {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 42px;
color: var(--cpd-color-text-primary);
background-color: var(--stopgap-background-85);
display: flex;
align-items: center;
justify-content: flex-end;
overflow: hidden;
z-index: 1;
transition: opacity ease 0.15s;
}
.toolbar:not(:hover) {
opacity: 0;
}
.toolbar:hover + .presenterLabel {
top: calc(42px + 20px); /* toolbar + margin */
}
.button {
margin-right: 16px;
}
.button svg {
width: 16px;
height: 16px;
}
.videoMutedOverlay {
width: 100%;
height: 100%;
background-color: var(--cpd-color-bg-subtle-secondary);
}
.presenterLabel {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
background-color: var(--stopgap-background-85);
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
padding: 4px 8px;
font-weight: normal;
font-size: var(--font-size-caption);
line-height: var(--font-size-body);
}
.screensharePIP {
bottom: 8px;
right: 8px;
width: 25%;
max-width: 360px;
border-radius: 20px;
}
.debugInfo {
position: absolute;
top: 16px;
left: 16px;
background-color: rgba(0, 0, 0, 0.5);
}
/* CSS makes us put a condition here, even though all we want to do is
unconditionally select the container so we can use cqmin units */
@container videoTile (width > 0) {
.avatar {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* To make avatars scale smoothly with their tiles during animations, we
override the styles set on the element */
--avatarSize: 50cqmin; /* Half of the smallest dimension of the tile */
width: var(--avatarSize) !important;
height: var(--avatarSize) !important;
border-radius: 10000px !important;
}
}