ph/components

Video embed

16:9 YouTube embed.

<VideoEmbed id="youtube-id" title="Demo night" />

Code

Copy into src/components/ph/ .

VideoEmbed.astro
---
type Props = {
  id: string;
  title: string;
  class?: string;
};

const { id, title, class: className } = Astro.props;
---

<div class:list={["relative aspect-video w-full overflow-hidden border border-border bg-ph-black", className]}>
  <iframe
    class="absolute inset-0 size-full"
    src={`https://www.youtube-nocookie.com/embed/${id}`}
    title={title}
    loading="lazy"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; picture-in-picture"
    allowfullscreen></iframe>
</div>