Embed Twitter video

by Kofi Gumbs on

Last night, I spent some time exploring Twitter’s documentation for embedding tweets. I needed to embed a tweet with an attached video, play the video programmatically, and detect when the video finishes. Twitter has no such API to observe playback state… but HTML5 video does! Here is my workaround, which hopefully saves you some time:

My API, described above, is universally accessible on this site:

GET https://kofi.sexy/.netlify/functions/embed-twitter-video?tweet=<YOUR TWEET ID>

I’ll continue to host it until I run into limitations with Twitter or Netlify. You can view the source code on GitHub and a live example below:

iframe