Skip to content Skip to sidebar Skip to footer

How Do I Use Javascript To Automatically Switch To A Backup Live Stream If Primary Fails In Jwplayer?

I am attempting to write a javascript function that will enable an instance of JW Player to automatically switch from a primary live HLS stream to a backup live HLS stream in the e

Solution 1:

One of our engineers just wrote a great blog post about this solution, including code samples: https://www.jwplayer.com/blog/building-insights-video-experience/

insightsPlayer.on('error', function(event) {
  playStream('error');
});

insightsPlayer.on('complete', function(event) {
  playStream(currentStream);
});

If there’s an error, the player switches to the error file. The video is a 10-second still that displays an informational slide. Once that completes, the player tries to play the previously determined currentStream.

Post a Comment for "How Do I Use Javascript To Automatically Switch To A Backup Live Stream If Primary Fails In Jwplayer?"