Live streaming with headless chrome

Sebastian Pereyro
Empirical
Published in
2 min readFeb 9, 2018

I recently learned about headless chrome and started playing a bit with it to see what could be done.

As I looked closer, got excited about things you can do with it, and started thinking on different use cases. At the time, I was working on a project with a live streaming component, so I got some inspiration from there and I came up with a challenge.

How to use headless chrome to stream a website (video + audio) to an RTMP endpoint.

It was a nice challenge, mainly to figure out how to first get the audio from the website and second to have the video and audio in sync.

It was not trivial, at least for me, needed to get familiar with PulseAudio, and how it works to get the sound from a particular browser tab. It actually became a personal challenge, and I finally got something working.

Here is a presentation where I show a little bit of background of this experiment: https://docs.google.com/presentation/d/1b-HvxKmeFYE3qoNDJDHfbgVwEbi0QgmTvpH8w4CK5Tw/edit?usp=sharing

I think it can be useful for a few use cases.

I would love any feedback or ideas you might have on how we could use this POC.

Demos:

Streaming to Facebook Live
Here is a demo where I am triggering the recording of a website that embeds a video from youtube and then sends it to Facebook: https://www.youtube.com/watch?v=V4TVfMjMy_k

Streaming to Youtube Live
Here is a demo of a recording of a Bitcoin Ticker and sending the stream live to youtube: https://www.youtube.com/watch?v=K943cKvEmuI&t=21s

--

--

Sebastian Pereyro
Empirical

Entrepreneur, System and Software Engineer. Love helping founders build amazing products. Passionate about my family and friends.