feature: youtube embeds

fix: little more padding
This commit is contained in:
Andy Burke 2025-07-24 13:07:41 -07:00
parent f20aecb90b
commit 5f4f1eecc5
2 changed files with 17 additions and 0 deletions

View file

@ -61,6 +61,7 @@
left: 0;
right: 0;
bottom: 5rem;
padding: 0.5rem;
}
#talk #room-chat-entry-container {

View file

@ -7,6 +7,22 @@ const URL_MATCH_HANDLERS = [
return;
},
(match) => {
const original_url = match[0];
const {
groups: { video_id },
} =
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)(?<video_id>[^"&?\/\s]{11})/gi.exec(
original_url,
);
if (!video_id) {
return;
}
return `<iframe width="560" height="315" src="https://www.youtube.com/embed/${video_id}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>`;
},
// url
(match) => {
// TODO: punycoding if something has unicode?