'use client' import { useState } from 'react' import { EMBED_PLAYER_LABELS, getEmbedPlayerAspect, type EmbedPlayerParams, } from '@/utils/embedPlayer' interface EmbedPlayerProps { params: EmbedPlayerParams /** Original URL, used for the "open externally" affordance and alt text. */ url: string className?: string } /** * Renders an inline media player for a recognised provider (YouTube, Twitch, * Spotify, Vimeo, SoundCloud, Apple Music, Giphy). * * To avoid auto-loading third-party iframes (and the privacy / performance * cost that entails), non-GIF embeds start as a click-to-load facade showing * the provider name. Only after the user opts in do we mount the iframe. * GIFs render directly as images since they carry no autoplay-with-audio cost. */ export default function EmbedPlayer({ params, url, className = '' }: EmbedPlayerProps) { const [activated, setActivated] = useState(false) const aspect = getEmbedPlayerAspect(params.type) const label = EMBED_PLAYER_LABELS[params.source] const frameStyle: React.CSSProperties = aspect.aspectRatio ? { aspectRatio: String(aspect.aspectRatio) } : { height: aspect.height } // GIFs: render as a plain image, no iframe, no facade. if (params.isGif) { return (