From c3ba8725535d5c4d095a94ad9c997b07221d5145 Mon Sep 17 00:00:00 2001 From: sup39 Date: Tue, 6 Feb 2024 13:42:49 +0900 Subject: [PATCH] fix: video player in room timeline --- src/app/organisms/room/RoomTimeline.tsx | 8 ++++++-- src/app/organisms/room/message/VideoContent.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/organisms/room/RoomTimeline.tsx b/src/app/organisms/room/RoomTimeline.tsx index 483356d..22fba03 100644 --- a/src/app/organisms/room/RoomTimeline.tsx +++ b/src/app/organisms/room/RoomTimeline.tsx @@ -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 ( ( )} {srcState.status === AsyncStatus.Success && ( - +