diff --git a/src/components/content/video-embed.tsx b/src/components/content/video-embed.tsx index 09dedc9..472d5f0 100644 --- a/src/components/content/video-embed.tsx +++ b/src/components/content/video-embed.tsx @@ -3,25 +3,19 @@ interface VideoEmbedProps { id: string; } -const platformSrcMap: Record = { - youtube: "https://www.youtube.com/embed/", - bilibili: "https://player.bilibili.com/player.html?bvid=", -}; - -export function VideoEmbed({ - platform, - id, -}: VideoEmbedProps) { - const src = platformSrcMap[platform] + id; +const platformSrcMap = { + youtube: (id: string) => `https://www.youtube.com/embed/${id}`, + bilibili: (id: string) => + `https://player.bilibili.com/player.html?bvid=${id}&autoplay=0`, +} as const; +export function VideoEmbed({ platform, id }: VideoEmbedProps) { return ( -
-