mirror of
https://github.com/mastodon/mastodon.git
synced 2026-08-22 11:55:10 -05:00
Fix embedded videos restarting when interacting with post (or other posts in the same feed) (#39746)
This commit is contained in:
@@ -72,15 +72,24 @@ interface CardProps {
|
||||
sensitive?: boolean;
|
||||
}
|
||||
|
||||
const CardVideo: React.FC<{ card: CardShape }> = ({ card }) => (
|
||||
<div
|
||||
className='status-card__image status-card-video'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: handleIframeUrl(card.html, card.url, card.provider_name),
|
||||
}}
|
||||
style={{ aspectRatio: '16 / 9' }}
|
||||
/>
|
||||
);
|
||||
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 (
|
||||
<div
|
||||
className='status-card__image status-card-video'
|
||||
dangerouslySetInnerHTML={iframeContent}
|
||||
style={{ aspectRatio: '16 / 9' }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const Card: React.FC<CardProps> = ({ card: rawCard, sensitive }) => {
|
||||
const card: CardShape | null = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user