fix(stories): restore full-bleed mobile video rendering

The aspect-ratio-sized box from the previous commit caused a
mobile-only bug — video appeared cropped/zoomed instead of fitting.
Root cause not fully isolated (mux-player's object-fit default is
contain, confirmed in its source, so it wasn't that), but the sized
box is the only recent change in that path. Gates it to sm+ viewports
via a CSS custom property + Tailwind arbitrary aspect-ratio, and
reverts to full-bleed + explicit object-fit: contain below that —
the combination already verified working before the box-sizing
change.
This commit is contained in:
admin committed 2026-08-16 14:54:15 +02:00
1 parent 07c0f82293
commit 661f36475a
1 file changed
+11 -8
+11 -8
View File
@@ -227,16 +227,19 @@ export function StoryViewer({
// The player BOX itself is sized to the video's real aspect
// ratio (default 9:16 — most story videos are phone-shot
// portrait — until Mux reports the actual value), not just the
// content inside a full-bleed box. object-fit: contain on a
// full-screen box still leaves a full-screen click/visual
// target with the letterboxing baked into the box; sizing the
// box itself means the black is purely the backdrop showing
// through, not part of the box.
// content inside a full-bleed box, on sm+ viewports. Below sm,
// stay full-bleed with object-fit: contain doing the letterbox-
// ing — sizing the box itself via computed aspect-ratio caused
// a mobile-only rendering bug (video appeared cropped/zoomed),
// so this only applies where it was actually verified to work.
<div className="relative w-full h-full flex items-center justify-center">
<div
className="relative h-full w-auto max-w-full"
className="relative w-full h-full sm:h-full sm:w-auto sm:max-w-full sm:aspect-[var(--story-video-ratio)]"
style={{
aspectRatio: (currentStory.aspectRatio ?? "9:16").replace(":", " / "),
["--story-video-ratio" as string]: (currentStory.aspectRatio ?? "9:16").replace(
":",
"/"
),
}}
>
{videoStatus === "READY" && videoPlaybackId ? (
@@ -245,7 +248,7 @@ export function StoryViewer({
streamType="on-demand"
autoPlay
muted={isMuted}
style={{ width: "100%", height: "100%" }}
style={{ width: "100%", height: "100%", objectFit: "contain" }}
onTimeUpdate={handleVideoTimeUpdate}
onEnded={handleVideoEnded}
/>