feat(call): VideoStub accepts fit prop, contain when focused
This commit is contained in:
@@ -129,7 +129,7 @@ export function CallParticipantTile(props: ParticipantTileProps) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{video ? (
|
{video ? (
|
||||||
<VideoStub {...props} small={small} />
|
<VideoStub {...props} small={small} fit={focused ? 'contain' : 'cover'} />
|
||||||
) : (
|
) : (
|
||||||
<AudioContent {...props} small={small} />
|
<AudioContent {...props} small={small} />
|
||||||
)}
|
)}
|
||||||
@@ -303,7 +303,8 @@ function VideoStub({
|
|||||||
videoTrack,
|
videoTrack,
|
||||||
me,
|
me,
|
||||||
small,
|
small,
|
||||||
}: ParticipantTileProps & { small: boolean }) {
|
fit,
|
||||||
|
}: ParticipantTileProps & { small: boolean; fit: 'cover' | 'contain' }) {
|
||||||
const videoRef = useRef<HTMLVideoElement | null>(null);
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = videoRef.current;
|
const el = videoRef.current;
|
||||||
@@ -330,7 +331,8 @@ function VideoStub({
|
|||||||
playsInline
|
playsInline
|
||||||
muted
|
muted
|
||||||
className={
|
className={
|
||||||
'h-full w-full object-cover ' +
|
'h-full w-full ' +
|
||||||
|
(fit === 'contain' ? 'object-contain ' : 'object-cover ') +
|
||||||
(me ? 'scale-x-[-1]' : '') /* mirror local preview */
|
(me ? 'scale-x-[-1]' : '') /* mirror local preview */
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user