Remove, Add, Replace Tracks in case of External Stream

470 views
Skip to first unread message

Murtaz Naqvi

unread,
Feb 16, 2021, 2:26:21 AM2/16/21
to meetecho-janus
Hi Meetecho Team,

Thank you for the awesome media server. 

The problem I am facing right now is, when I pass external stream from getUserMedia() to Janus JS SDK. All the media parameter stops working including removeVideo, replaceVideo etc. 

I want to renegotiate, what will be the best practice in case of external stream?


Regards.
Muhammad Murtaz 

Christian Fynbo

unread,
Feb 17, 2021, 5:25:49 AM2/17/21
to meetecho-janus
Hey!

I have the exact same question. Having searched the forum with no results (an older post from 2018 where Lorenzo justed linked to the API docs) I was about to make a post when Muhammad beat me to it.

Is there any way to provide own stream and still use replaceVideo? Any example?

Nauman Moazzam

unread,
Feb 17, 2021, 7:17:34 AM2/17/21
to meetecho-janus
Hey,

Did you find any solution yet? I am having same issue. Need example..

Christian Fynbo

unread,
Feb 19, 2021, 1:30:38 PM2/19/21
to meetecho-janus
No, awaiting help from Lorenzo (hopefully)

Lorenzo Miniero

unread,
Feb 20, 2021, 4:02:31 AM2/20/21
to meetecho-janus
I'm not going to work on that anytime soon. Too busy and other priorities, sorry.

L.

Message has been deleted

Nikhil Doosari

unread,
Feb 20, 2021, 4:33:21 AM2/20/21
to meetecho-janus
Hi guys, 
I  have a solution for this using  =>   pluginHandle.webrtcStuff.pc.getSenders()[0].replaceTrack(stream.getVideoTracks()[0],stream);
but here I am using only one RTP sender so directly I am taking getSender()[0]
if you're using audio and video you need to check RTP sender kind whether it is audio or video and you need to replace those kinds of tracks only

Thanks,
Nikhil 

Christian Fynbo

unread,
Feb 20, 2021, 10:12:17 AM2/20/21
to meetecho-janus
@Lorenzo - No one expect you to work on it - but a few years ago, someone asked the same question and you simply sent him a link to the JS docs. So maybe there was something we missed.

@Nikhil - Will try your solution - Do one need to do anything else besides your instructions?

Nikhil Doosari

unread,
Feb 20, 2021, 10:43:11 AM2/20/21
to meetecho-janus
@Fynbo there is no steps simply take a new stream and fetch the RTP sender from the previously published plugin handler and replace the track 
you can easily switch from one device to another, screen share stream to camera stream, and vice versa without attaching new plugins 

Christian Fynbo

unread,
Mar 3, 2021, 8:09:40 PM3/3/21
to meetecho-janus
It's working now by using replaceTrack but after a few switches or after muting video-feed, there is a huge delay.

First time it works fine but afterwards the video delay just keeps increasing. Any ideas?

Yurii Cherniavskyi

unread,
Mar 4, 2021, 12:27:36 AM3/4/21
to meetecho-janus
I think the best way to get some valuable help with such task/issue is to provide a minimal code snippet or event demo with which everyone could try to reproduce it.
Reply all
Reply to author
Forward
0 new messages