From 97353fde68d3b5666ac7d5e68c877a64011f40cb Mon Sep 17 00:00:00 2001 From: diondiondion Date: Tue, 7 Jul 2026 15:13:55 +0200 Subject: [PATCH] Fix embedded videos restarting when interacting with post (or other posts in the same feed) (#39746) --- .../features/status/components/card.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/javascript/mastodon/features/status/components/card.tsx b/app/javascript/mastodon/features/status/components/card.tsx index 2452ab6494d..d9ec5b1d782 100644 --- a/app/javascript/mastodon/features/status/components/card.tsx +++ b/app/javascript/mastodon/features/status/components/card.tsx @@ -72,15 +72,24 @@ interface CardProps { sensitive?: boolean; } -const CardVideo: React.FC<{ card: CardShape }> = ({ card }) => ( -
-); +const CardVideo: React.FC<{ card: CardShape }> = ({ card }) => { + const { html, url, provider_name } = card; + + const iframeContent = useMemo( + () => ({ + __html: handleIframeUrl(html, url, provider_name), + }), + [html, provider_name, url], + ); + + return ( +
+ ); +}; const Card: React.FC = ({ card: rawCard, sensitive }) => { const card: CardShape | null = useMemo(