fix: video player in room timeline

This commit is contained in:
sup39 2024-02-06 13:42:49 +09:00
parent 580216f11a
commit c3ba872553
Signed by: sup39
GPG key ID: 111C00916C1641E5
2 changed files with 7 additions and 3 deletions

View file

@ -1139,13 +1139,17 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
return null;
}
const height = scaleYDimension(videoInfo.w || 400, 400, videoInfo.h || 400);
// FIXME
const videoW = videoInfo?.w ?? 400;
const videoH = videoInfo?.h ?? 400;
const maxW = scrollRef.current?.querySelector(`[data-message-id]>div>div:nth-child(2)`)?.clientWidth ?? 400;
const height = videoW <= maxW ? videoH : scaleYDimension(videoW, maxW, videoH);
return (
<Attachment>
<AttachmentBox
style={{
height: toRem(height < 48 ? 48 : height),
height: toRem(Math.max(48, Math.min(480, height))),
}}
>
<VideoContent

View file

@ -116,7 +116,7 @@ export const VideoContent = as<'div', VideoContentProps>(
</Box>
)}
{srcState.status === AsyncStatus.Success && (
<Box className={css.AbsoluteContainer}>
<Box className={css.AbsoluteContainer} style={{position: 'unset'}}>
<Video
title={body}
src={srcState.data}