awslabs / amazon-kinesis-video-streams-webrtc-sdk-android

Android SDK for interfacing with Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
58 stars 37 forks source link

please help me with multiviewer support #20

Closed ranjanpucsd closed 3 years ago

ranjanpucsd commented 4 years ago

app is not working for more than one viewer .i need multi-viewer support . in readme file Optionally, when using it in viewer mode, you can enter a unique Client Id . Client ID is required only if multiple viewers are connected to a channel. This helps channel's master identify respective viewers. I couldn't understand above line. please help me thanks in advance.

aragorntheking commented 4 years ago

I am facing the same issue. The demo does not seem to work for multiple viewers connecting to the same channel even when different client Ids are provided. As soon as the 2nd client is connected, both the viewers stops receiving any frames

varun27wahi commented 4 years ago

Same issue for me. There's no documentation other than sample app which we can refer to.

varun27wahi commented 4 years ago

So I got it to work. The sample app is designed for 1:1 communication. AS soon as as new viewer connects to the master, the remote description for the master changes and the old connection lost. To solve this, I created a HashMap for the master to store all connections. Whenever the master received an offer from a new viewer, I created a new entry in the HashMap, so that each new connection is unique.

jeryini commented 4 years ago

Hello @varun27wahi !

Care to share your code fix here? It would be greatly appreciated!

varun27wahi commented 4 years ago

Hi @jeryini!

Unfortunately I can't share the code since it is not a personal project. I can give you a basic overview of what I did and you can reach out me if you still have doubts.

I basically replaced the single PeerConnection localPeer member with a HashMap<String, PeerConnection>, where the key is a viewer's client ID. Then whenever a new offer comes in, create a new entry in the map. Rest of the process is same as what's done in the existing code. Hope this helps!

jeryini commented 4 years ago

Hi @varun27wahi!

Thank you for your explanation. Will try to reproduce your solution.

MushMal commented 3 years ago

Closing this for now. The sample is not designed to fully support the multi-client.

nikinci commented 3 years ago

Hi @jeryini Did you apply the solution? Can you share the code if you fixed the problem?