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.27k stars 628 forks source link

Configurable viewer limit for a conference room #4167

Open sumit-anantwar opened 2 years ago

sumit-anantwar commented 2 years ago

Is your feature request related to a problem? Please describe. Currently, a conference room allows an unlimited number of viewers to join. We require that when a presenter creates a room, he should be able to specify how many viewers are allowed to join the room. Once the room is "full" any subsequent attempt to join should be denied with an appropriate error.

If the parameter isn't specified, the default would be unlimited viewers as it is now. This will also provide backward compatibility, and won't cause any interruption for the existing AntMedia users.

Describe the solution you'd like When creating a conference room, add a new parameter to the API call to specify the maxViewers count.

{
  "roomId": "id_of_room",
  "maxViewers": 100,  // <-- New parameter
  "startDate":"start_date_of_room",
  "endDate":"end_date_of_room"
}

Describe alternatives you've considered --- NA ---

Additional context We provide subscription tiers to our users based on the number of viewers permitted for each conference. Limiting the number of viewers will also allow keeping our expenses in check.

mekya commented 2 years ago

Thank you for the issue. It's a good point. Moving the backlog to schedule.

sumit-anantwar commented 2 years ago

@mekya is there any update on this? Is there any estimated release date?

mekya commented 2 years ago

Hi @sumit-anantwar ,

Thank you for follow up. We've changed the conferencing style.

I mean no need to have conferencing datatype. Conference room is also a stream and each stream has substreams(subtracks). I mean the current webrtc viewer limit probably will work in this scenario. You can take a look at this sample on multitrack-conference.html

Is there a chance that you can try and let us know if it work for you?

Regards, A. Oguz

sumit-anantwar commented 1 year ago

Hello @mekya We had postponed this implementation and, hence didn't get a chance to try it out. But now it's back on priority. I will take a look and let you know.

Thanks

mekya commented 1 year ago

Thank you @sumit-anantwar

sumit-anantwar commented 1 year ago

@mekya We went through the code you suggested, but weren't able to find any implementation for the viewer limit. To clarify our requirement let me try to explain the use-case again.

We provide tier-based subscription to our users. The tiers are based on the number of people allowed to connect to the stream at any given moment. Currently we provide three tiers, 25, 60, 250

So, let's assume, a host starts a conference with 60 max allowed participants. Once all allowed participants have joined the stream, any new participant trying to join should be denied access. If few participants leave the stream, for example 5 participants, the total participant count would now be 55, and 5 new participants would be allowed to join.

Pleaswe let me know if you need any more info.

mekya commented 1 year ago

Hi @sumit-anantwar,

Thank you very much. WebRTC Viewer Limit and Conferencing may be confusing. We also need to check something in our end.

Are available to have a meeting to show Viewer Limit demo and discuss how to proceed? If yes and would like to speed up the process, just send an email to contact@antmedia.io to let us schedule meeting in our earliest convenient time because I check github updates weekly.

timantmedia commented 1 year ago

@mekya I am following up with this, are you referring to the logic seen in the multitrack player sample page here

http://ant-media-server/{application}/multitrackplayer.html

by utilizing the webRTCAdaptor.getTracks(streamNameBox.value, token); method from the WebRTC Adaptor to fetch the total tracks in the conference.

I think you can call this method before anyone joins the conference room to check how many people have already joined.

There is also the API that can return the roomStreamList so you can count the amount of users currently in the conference.

If not, let me schedule a meeting with the customer

timantmedia commented 1 year ago

@mekya As discussed, setting a viewer limit does not restrict the amount of participants to a conference room as the denied user still publishes their stream.

Is the only way to achieve this is to implement another layer to check the amount of participants before presenting the user with the ability to join the room? At a guess, this would mean additional custom logic the customer needs to add themselves.

sumit-anantwar commented 1 year ago

@timantmedia Thank you for following up on this. Handling Viewer Limit on the client side is pretty cumbersome. Mainly because the viewers are making the join request to the AntMedia Server, not the client. And secondly, the current viewer count isn't available in the WebSocket RoomInfo messages. We have to call the REST API to fetch the viewer count and then compare. But, even if we get the viewer count, selectively booting the viewers would be a task in itself.

mekya commented 11 months ago

It may be a duplication of https://github.com/ant-media/Ant-Media-Server/issues/5723

mekya commented 11 months ago

It's working and it needs refactor

sumit-anantwar commented 11 months ago

@mekya thank you for the update.

sumit-anantwar commented 8 months ago

@mekya Can you please provide updates on the status of this feature? What's the new estimate?

burak-58 commented 1 month ago

Hi @sumit-anantwar, We provided a solution in https://github.com/ant-media/Ant-Media-Server/issues/5723. Did you have a chance to try it?

sumit-anantwar commented 1 month ago

@burak-58 I'm waiting for the websocket API docs. It's a busy period, so I'm not able to deploy a beta image just for testing. Please let me know when the update is deployed on AWS.