ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.28k stars 632 forks source link

Regarding streams which are on ant media server even after the browser which is producing them is closed. #4250

Open UjjwalShinde opened 2 years ago

UjjwalShinde commented 2 years ago

I'm publishing streams on antmedia server through webrtc. it works completely fine if we stop stream with the given way in antmedia, using stop command through web socket but if user closes the browser without stopping the stream publish, the stream stops on server side too but sometimes stream remains on a server with nothing in it. If we play the stream on server it says: " stream will start playing automatically when it is live". Is there any way to handle this case?

mekya commented 2 years ago

Thank you @UjjwalShinde for the issue. Moving to the backlog to schedule.

Do you have any exact reproduce scenario?

UjjwalShinde commented 2 years ago

There is no exact reproduce scenario. It happens sometimes only. So here is a scenario: I'm publishing my shared screen stream through browser. Stream name is visible on ant media server. Now if I close the connection through proper way using stop command through websocket then stream on the server will also stop. But in corner case if user closes browser before stopping the connection then most of the time stream on the server will stop also but sometimes it remains on server. If it remains on server the behaviour of stream is mentioned above. So if user start to publish again with the same stream id then "streamId already in use " callback error comes.

mekya commented 2 years ago

Thank you @UjjwalShinde ,

We've implemented a solution to prevent getting streamId already in use error in this issue https://github.com/ant-media/Ant-Media-Server/issues/4172

It's definitely worth to try to reproduce the problem and fix it.

Btw, there is a 5 or 10 seconds timeout value for these kind of connection drops to let the user re-connect and publish again so that viewers don't need to reconnect to the server to start watching again. It just provides a better experience.

FYI

UjjwalShinde commented 2 years ago

But streams are remaining on server for days( and not getting removed). even after the browser producing them is closed.

UjjwalShinde commented 2 years ago

Screenshot (7) these 2 streams are there on my server from past few days.

mekya commented 2 years ago

Thank you @UjjwalShinde

We've scheduled this issue for this week and one of colleague(@SelimEmre) is responsible for that.

Btw, Could you tell which AMS version you use and let us know your settings? They may be helpful to reproduce the problem on our side.

UjjwalShinde commented 2 years ago

Version : Enterprise Edition 2.4.0.2 20210905_1241

Settings : H.264 is enabled "WebRTC Data Channel" is enabled (with only publisher) "Create HLS Streaming" is enebled : Segment List Size=5 ,Segment Duration=2. Stream Security -> "Accept Undefined Streams" is enabled

SelimEmre commented 2 years ago

Hi @UjjwalShinde,

Could you please upgrade to the latest version (v2.4.3) so we can understand if the issue still persists or not?

Best Regards, Selim

SelimEmre commented 2 years ago

Hi @UjjwalShinde,

Did you have a chance to check it?

Best Regards, Selim

UjjwalShinde commented 2 years ago

hi @SelimEmre Thank you for the help. We have updated our ant media server. This problem doesn't occur frequently so we will monitor our server for few days. I'll let you know the results in few days.

UjjwalShinde commented 2 years ago

hi @SelimEmre It seems like the problem is solved by updating Ant media server. Thank you for dedicating your time.

SelimEmre commented 2 years ago

Hi @UjjwalShinde,

It's great to hear that. Please let us know If there is anything we can help you with.

Best Regards, Selim