Catch HLS stop event while playing a live HLS stream

f... — Jul 29, 2016 10:08AM EDT

Hi everyone,

My goal:I need to implement a live streaming (HLS) fallback.When the primary stream stops, JWPlayer push an event, then we load the backup stream.

The problem:- With playlist two problems: 1. as long as an HLS stream is supported by the viewer environment JWP try to load the M3U8 and, event if it's 404 it don't move to the next playlist item, 2. This is done only one time, when loading so for fallback in case of live stream stops after loading this is not the good answer

- With event catching:I'm only able to catch a 404 when first loading the stream.but if it loads correctly and then stops (so let say 404 on M3U8) JWP seem to not know it :(

The solution:What could be a good test to see if a stream is still alive?- framerate - other ?

2 Community Answers

Alex

My name is Alex and I am one of the Team Leads of the Support Team at JW Player. I will be more than happy to assist you with your questions.

When supplying multiple sources for a piece of content, the player will only fallback to the next source if the first source if not supported in the environment that it is being viewed in. For example, since HLS streams are currently only renderable in Firefox using Flash, let’s assume you’re supplying a HLS stream as your primary source and a MP4 as your secondary source/fallback. If the viewer doesn’t have Flash Player installed, or otherwise has it disabled in Firefox, the player will skip over the HLS stream and play the MP4.

As for catching errors – since there are several different reasons why media can either have issues playing or stop playing, in addition to different behaviors in different operating systems or devices, there would be no way for our player to be able to gracefully handle all of them. As a rule of thumb, the player expects the stream to be a valid stream that plays consistently.

As for a good test to see if a stream is still alive, there wouldn’t be one. This is because any event that provides information about the current stream, such as .on(‘time’) or .on(‘meta’) only fire if the stream is actually playing. If an error is not broadcasted using the .on(‘error’) event, then there is simply no way for our player to act on that.