Jump to content
  • 0

Automatic fallback/fail over for live streams


bjornw
 Share

Question

Hi,
I'm wondering if there are any plans on implementing any fallback/fail over function for when a live stream goes offline? For example playing a local video file if a live stream abruptly goes down because of a bad connection from the streamer to the server.
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
10 hours ago, bjornw said:
Hi,
I'm wondering if there are any plans on implementing any fallback/fail over function for when a live stream goes offline? For example playing a local video file if a live stream abruptly goes down because of a bad connection from the streamer to the server.

Hello @bjornw

Ant Media is already taking care of this, Have a look at the JS code snippets below.
 

function checkAndRepublishIfRequired() {
  var iceState = webRTCAdaptor.iceConnectionState(streamId);
  console.log("Ice state checked = " + iceState);

  if (iceState == null || iceState == "failed" || iceState == "disconnected"){
  webRTCAdaptor.stop(streamId);
  webRTCAdaptor.closePeerConnection(streamId);
  webRTCAdaptor.closeWebSocket();
  initWebRTCAdaptor(true, autoRepublishEnabled);
  }	
}

Also this file helps

https://github.com/ant-media/StreamApp/blob/40f896aeabbe90eb199a4a0cd3a238db01e4df53/src/main/webapp/samples/publish_webrtc.html#L427

 

Feel free to revert back if having any issue in implementation.

Thank you.

  • Like 2
Link to comment
Share on other sites

  • 0

Great to hear, thanks for the quick answer!

Is there anyway similar functionality when not using webrtc? I’m doing SRT ingest and transcoding to HLS with adaptive bitrate.

Link to comment
Share on other sites

 Share

×
×
  • Create New...