We just added a few new events to Mux's Live Streams that let you build more helpful UIs for streamers and help debug issues when they happen. These include:
video.live_stream.connected) - The streamer's local software/hardware has successfully connected with Mux's live ingest servers and is starting to send video.
video.live_stream.disconnected) - The streamer has disconnected from Mux's servers, either intentionally by stopping the stream or unintentionally because of a network issue.
video.live_stream.recording) - Mux has started recording the incoming live stream from a streamer (no, this doesn't happen immediately after connecting. I'll explain.)
Up until now we've had two events, active and idle, which tell you when the live stream is playable and when it's finished, respectively.
Depending on the video being streamed, it can take between 10 and 20 seconds from when the streamer first connects to when a Live Stream is first playable (active). That can feel like a long time to sit and wonder if the stream is working before getting the first event back from Mux.
This where the connected event comes in: as soon as the streamer successfully connects, Mux will send a connected webhook event, and you can show your streamer a big :thumbsup: to let them know things are working so far.
After connecting, Mux will inspect the stream to make sure it can be supported. Once the stream has been validated, Mux will send the recording webhook event, which you could use to turn on a red recording light in your UI or something to let the streamer know they can start doing their thing.
Following the recording event, Mux will record some of the stream before firing the active event. HTTP Live Streaming (HLS) requires 3 segments (each segment is a few seconds) of content before it will consider the HLS stream valid and not fail to play.
While the events won't change, some of the timing between events may be reduced as we work on a new low latency feature. Stay tuned, this one's going to be fun.
If you don't get a connected event within a few seconds of a streamer starting to stream, that's a sign that something's likely not working right with the streamer's software or the configuration of it. It's possible their software knows this and has informed the streamer of an error or recorded one in its logs.
Once a stream has started, Mux will send a disconnected event when the streamer's software disconnects from Mux. This can happen when the streamer hits "stop streaming", or when the network drops for 30 seconds or more (long enough for the TCP connection to expire). If a streamer is having trouble keeping the connection stable, you can use the disconnected event in the event log of a Live Stream to understand what Mux saw.
As always, let us know if you have any thoughts, questions, or comments on this new addition.
No credit card to start. $20 in free credits when you're ready.
50 Beale Street, Floor 9
San Francisco, CA, 94105
34-37 Liverpool Street
Unit 4.06, 4th Floor
London, EC2M 7PP