flutterjanus/flutter_janus_client

Get same preview in two different janus client

ChiragLiveu opened this issue · 11 comments

I have run two separate clients using two separate channels and web IDs but sometimes in the preview layer, I will get the same preview in both the instance in iOS & Android as well. I have debugged and checked each time I have pass two different webID to stream and on the server side it takes two different request and its send proper preview but in mobile side it take same preview layer sometimes

First of all there should be description of your issue second this needs to be asked in discussion since its not an issue
Hence closing.

I have run two separate clients using two separate channels and web IDs but sometimes in the preview layer, I will get the same preview in both the instance in iOS & Android as well. I have debugged and checked each time I have passed two different webID to stream on the server side it takes two different requests and sends a proper preview but on the mobile side it takes the same preview layer sometimes.

From what i understand
You should create single janus instance
Single JanusSession instance and on that same JanusSession you have to attach streaming plugin twice one for layer 1 and 1 for layer 2 and you have to manage both plugin handles webrtc negotiations seperately
Using watch=>offer from server=> start along with answer
And have two different onTrack on two different plugin handle instance setting up two different Media stream object which inturn is used by two different RTCVideoView

Your understanding is right, But I have created two different sessions with two different objects. And I have also analyzed the log that displays two separate sessions created. Not always but sometimes it gets the same preview in both sessions.

Try my approach

Ok I will try and let you know thank you for help

Hi shivanshtalwar,

I have tried your suggestion. I have created a single session and attached a streaming plugin twice with different webID as per your suggestion and manage separate layers but still, get the same preview on both layers. Can you please help me to resolve it? like the below code example

session = await j.createSession();
plugin = await session.attach();
plugin2 = await session.attach();

await plugin.watchStream(int.parse(widget.strWebID));
await plugin2.watchStream(int.parse(widget.strWebID2));

and handle their stream, track, and RTCVideoView as required. I will get the two audio but not the preview layer. This issue i will not get all time but out of 10 I have issue 4 times

Maybe you can give me access to your complete example and i will have a look

Componenet.zip
Can you please look into file and can you please guide me on the same
In this file i have create custom component and render in any file.

lu_video_preview_v2.dart.zip
i haven't tested it but that should be the correct way you overcomplicated the whole code
all you need was two Renderers and two mediaStream in which you add all tracks respectively

Well if you want then we can do paid consultation at 60€ per hour