Jump to content
  • 0

Publish a broadcast simultaneously to two applications


AGIS
 Share

Question

I have an HTML page that uses the javascript WebRTCAdaptor to broadcast to an Ant Media Server application.
Is there a way for that page to publish the broadcast to two (or more) different Ant Media Server applications simultaneously?
If so, can it be done without sending two identical streams of data and doubling the bandwidth?

 

Thanks

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @AGIS,

How are you!

One of the solutions is to publish the stream to the Ant Media Server application and add the RTMP endpoint for another AMS application so that first one will push the RTMP to second one.

Also I would like to understand your use case and the idea behind this feature. Maybe you can use clustering  to have different AMS instances clubbed together and in this way the same stream will be accessible to all the nodes.

 

Thank you 

Link to comment
Share on other sites

  • 0
On 5/25/2022 at 11:43 AM, Mohit said:

Hi @AGIS,

How are you!

One of the solutions is to publish the stream to the Ant Media Server application and add the RTMP endpoint for another AMS application so that first one will push the RTMP to second one.

Also I would like to understand your use case and the idea behind this feature. Maybe you can use clustering  to have different AMS instances clubbed together and in this way the same stream will be accessible to all the nodes.

 

Thank you 

Hello Mohit,


Thank you for your suggestions.  


My use case is that I would like to use different Ant Media Applications to separate groups of users.  Group Alpha would use the Alpha Application and only see broadcasts relevant to Group Alpha.  Group Bravo would use the Bravo Application, etc... But, there are some broadcasts that I would like more than one group (or sometimes all groups) of users to have access to.  When a user begins publishing a broadcast, he knows what applications should have access to it.  This setup would need to be very dynamic so when someone publishes, the users of the desired applications would have access to it without having to know special information like "go to another application URL and watch a certain stream".  I also can not expect an administrator to access the web console to set things up whenever a new broadcast is created.

 

Thanks

 

Link to comment
Share on other sites

  • 0
13 hours ago, AGIS said:

Hello Mohit,


Thank you for your suggestions.  


My use case is that I would like to use different Ant Media Applications to separate groups of users.  Group Alpha would use the Alpha Application and only see broadcasts relevant to Group Alpha.  Group Bravo would use the Bravo Application, etc... But, there are some broadcasts that I would like more than one group (or sometimes all groups) of users to have access to.  When a user begins publishing a broadcast, he knows what applications should have access to it.  This setup would need to be very dynamic so when someone publishes, the users of the desired applications would have access to it without having to know special information like "go to another application URL and watch a certain stream".  I also can not expect an administrator to access the web console to set things up whenever a new broadcast is created.

 

Thanks

 

Hi,

Thank you for the details.

 

In this case you can simply use REST API call to add RTMP endpoint to the stream.

So suppose if you have two applications A and B. When you start a broadcast to application A, you can add the RTMP endpoint of application B to the application A stream using REST API call.

https://antmedia.io/rest/#/BroadcastRestService/addEndpointV3

 

Thank you 

Link to comment
Share on other sites

  • 0

spacer.png

 

Your current setup is like this.  So to limit stream access scopes you are using different applications. that means for every new private broadcast scope you will need to add a new application to the server. this might work out initially but as you can see now it becomes complex over time when you need to share a stream between these scopes. The proper design for this is to have single application and have automation system to guide subscribers to a stream. the pseudo flow is as follows:

 

1. Publisher starts a stream

2. As soon as publish starts have a automation create a database entry with the application name, stream name and any other scope information that is needed to access the stream.

3. The subscriber side checks the database to know if the stream is live or not. if yes then it will fetch the stream details and connect to it to playback. note that it si the client side logic (browser) which is doing that.

4. Once publisher stops the entry will be removed from database. server sees that there is no stream and disconnects subscriber. the subscriber logic check s database and comes to know that this stream no longer exists so it can keep waiting and checking in regular intervals or just show a message and bow out.

5. If you have large number of subscribers consider using a cluster

6. You can also use ant media's token system to protect access to stream and so on.

 

This will be a much more scalable approach. Basically you need automation like a traffic redirector which knows what streams exist and when subscribers (player side logic) come it will give them the proper details about the stream so that they can connect to it and play . Hope that makes sense. Once the automation is in place you dont need administrator or anything.

 

 

  • Like 1
Link to comment
Share on other sites

  • 0
On 5/28/2022 at 5:16 AM, Connessione said:

spacer.png

 

Your current setup is like this.  So to limit stream access scopes you are using different applications. that means for every new private broadcast scope you will need to add a new application to the server. this might work out initially but as you can see now it becomes complex over time when you need to share a stream between these scopes. The proper design for this is to have single application and have automation system to guide subscribers to a stream. the pseudo flow is as follows:

 

1. Publisher starts a stream

2. As soon as publish starts have a automation create a database entry with the application name, stream name and any other scope information that is needed to access the stream.

3. The subscriber side checks the database to know if the stream is live or not. if yes then it will fetch the stream details and connect to it to playback. note that it si the client side logic (browser) which is doing that.

4. Once publisher stops the entry will be removed from database. server sees that there is no stream and disconnects subscriber. the subscriber logic check s database and comes to know that this stream no longer exists so it can keep waiting and checking in regular intervals or just show a message and bow out.

5. If you have large number of subscribers consider using a cluster

6. You can also use ant media's token system to protect access to stream and so on.

 

This will be a much more scalable approach. Basically you need automation like a traffic redirector which knows what streams exist and when subscribers (player side logic) come it will give them the proper details about the stream so that they can connect to it and play . Hope that makes sense. Once the automation is in place you dont need administrator or anything.

 

 

Thank you for your suggestion @Connessione.  I will be looking into doing something like what you have suggested.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...