flutterjanus / flutter_janus_client

A plugin that allows the flutter app to communicate with a Janus server using different transport mechanisms, such as WebSocket and HTTP(rest). It features a developer-friendly api to interact with various WebRTC Janus Plugins. Hence, it can be considered as a swiss-knife for WebRTC solutions.
MIT License
132 stars 76 forks source link

Get same preview in two different janus client #115

Closed ChiragLiveu closed 1 year ago

ChiragLiveu commented 1 year ago

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

shivanshtalwar commented 1 year ago

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.

ChiragLiveu commented 1 year ago

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.

shivanshtalwar commented 1 year ago

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

ChiragLiveu commented 1 year ago

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.

shivanshtalwar commented 1 year ago

Try my approach

ChiragLiveu commented 1 year ago

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

ChiragLiveu commented 1 year ago

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

shivanshtalwar commented 1 year ago

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

ChiragLiveu commented 1 year ago

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.

shivanshtalwar commented 1 year ago

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

shivanshtalwar commented 1 year ago

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