From 102f2f534a66a7ad6c2c614e53a32c98c7eb9926 Mon Sep 17 00:00:00 2001 From: Cesar Alcazar Date: Mon, 19 Oct 2026 17:11:33 -0600 Subject: [PATCH] qhkr2z22o: Prefer direct mp4Url for feed video playback with hls fallback --- src/components/PostCard.tsx | 4 ++-- src/components/VideoPlayer.tsx | 22 ++++++++++++++++------ src/lib/feed-model.ts | 27 ++++++++++++++++++++++----- tests/feed-view.test.ts | 18 +++++++++++++++++- tests/video-playback.test.ts | 21 +++++++++++++++++++++ 5 files changed, 78 insertions(+), 14 deletions(-) diff --git a/src/components/PostCard.tsx b/src/components/PostCard.tsx index 6616418..fb87ac7 100644 --- a/src/components/PostCard.tsx +++ b/src/components/PostCard.tsx @@ -87,9 +87,9 @@ export function PostCard({ post, now, onToggleLike, likeBusy, likeError, onSigne {deleteError ?

Could not delete the post.

: null} {post.text ?

{post.text}

: null} {post.media.map((m, i) => - m.kind === "video" && m.hlsUrl ? ( + m.kind === "video" && (m.mp4Url || m.hlsUrl) ? (
- +
) : m.src ? (
diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index dfb5f63..8c2c73e 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -4,7 +4,8 @@ import { useEffect, useRef, useState } from "react"; import { choosePlayback, supportsNativeHls } from "@/lib/video-playback"; export interface VideoPlayerProps { - hlsUrl: string; + mp4Url?: string | null; + hlsUrl?: string | null; poster: string | null; label: string; } @@ -12,17 +13,19 @@ export interface VideoPlayerProps { const UNPLAYABLE = "Video can't be played here."; /** - * Real
); } + if (!mp4Url && !hlsUrl) { + return poster ? ( + // eslint-disable-next-line @next/next/no-img-element + Video thumbnail + ) : null; + } return (