0

I want to create an android application that broadcasts stream to multiple users. Im using publisher token for both broadcaster and subscribers as i want to see the stream from all the subscribers that have subscribed to the main stream. Since all the subscribers are also publishing the stream simultaneously.The error that i faced is that, when a new subscriber joins the session, the new subscriber subscribes to another subscriber(user)'s steam rather than the main stream i want them to. Can you tell me , how do i make sure that everyone in the session subscribes to a particular stream from a particular person?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • 1
    Welcome to Stack Overflow! Please [edit] your question to show [the code you have so far](http://whathaveyoutried.com). You should include at least an outline (but preferably a [mcve]) of the code that you are having problems with, then we can try to help with the specific problem. You should also read [ask]. – Toby Speight Feb 07 '18 at 11:40

1 Answers1

0

If I understand, you want to create one publisher and multiple subscribers. For all the connections that are just receiving the stream, you just have to connect to the session, and subscribe when you receive the onStreamCreated event. You can create a different token for each publisher or subscriber, no need to reuse. If you want to change the person that is broadcasting, unpublish from the first one, and start publishing from a different one. That will cause onStreamCreated events to be sent, and all subscribers will start receiving the new stream. I hope this helps.

  • i haven't created a server to provide the token and Session ID. I m using hardcoded values for publisher and subscriber token. So, how can i create a different token for each publisher or subscriber? – Ribesh Mhrzn Feb 07 '18 at 13:00
  • You don't have to create your own sessionId, OpenTok will do it for you. And the same for tokens, the clients have functionality for you to create it, you don't have to do it yourself. – Francisco Javier Cano Sandoval Feb 07 '18 at 16:17
  • how do i make a person's stream to be either published or unpublished? what methods should i use? in other words , how do i accomplish what you mentioned in ta answer above. i.e "If you want to change the person that is broadcasting, unpublish from the first one, and start publishing from a different one."? – Ribesh Mhrzn Feb 07 '18 at 17:00
  • Look at this link: https://tokbox.com/developer/guides/publish-stream/android. There are lots of tutorials and information about the APIs with everything you need to create a basic publish/subscribe application. – Francisco Javier Cano Sandoval Feb 08 '18 at 10:28