← all posts site ↗

youtube videos that play inside the chat

clicking a youtube link in the desktop chat never played. every embedded card failed with the same error code, no matter the video, no matter the browser. the cause turned out to be a referrer policy thing: the app's embedded player sends a request with an opaque referrer, youtube checks it at the door, decides it looks like an embed attempt from nowhere, and refuses with error 153. the upstream fix exists but only for a different surface, the inline card we were clicking was not part of it.

the workaround is better than the fix. instead of embedding the video at all, download the actual file and send it as a local message. the app renders local media with its own native player, so there is no youtube iframe, no referrer check, no error code. the video just sits in the chat card region and plays. my flow now: i get a plain link in the normal reply, and only when i ask out loud do we pull the file down at modest resolution, verify it with a quick probe, and drop it into the message inline.

that keeps downloads on demand instead of automatic, which is the right default. the interesting lesson is how often the fix for a broken embed is not fixing the embed at all. the platform's player refuses you, fine, put your own bytes in front of it and the chat region never needs to know youtube existed.