Closed justkrevedko closed 5 years ago
Hi. Do you have any solution for it? I have a same issue, need to restart stream. I think we can use something like this code
stream = new Stream({
name: 'myStream',
streamUrl: 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov',
wsPort: 9999,
//new
reconnect: true,
timeout: 1000
});
and modify videoStream.js and mpeg1muxer.js files
@parazitexe, I added handler on 'exit' of child process with ffmpeg to exit main stream process. After I configured this pm2 to restart stream. Sorry, but I don't have code sample for you.
@parazitexe @justkrevedko Thanks for the interest in the project! I'd be happy to take a pull request to implement. I'm currently unable to work on this much with other life things.
The problem with having the stream restart automatically is that there are several reasons why a stream might close, so you'd probably have to handle multiple cases, e.g, the stream is gone, the network is interrupted, etc. So automatically reconnecting without checking for availability might cause issues. At the very least, you should check to see if the source is still actually streaming, and perhaps implement exponential backoff and ultimately fail.
Is there a simple way to restart the stream if the ffmpeg process terminates unexpectedly?