AudioBridge Plugin in React Native

346 views
Skip to first unread message

Karan Modi

unread,
Oct 15, 2018, 4:03:54 AM10/15/18
to meetecho-janus
Hi Everyone,

I'm trying to use the AudioBridge Plugin to stream audio from an Android Client to a remote Hub. The component to do the same is written in React-Native and primarily uses the following dependencies for the task.

"react": "^16.4.2",
"react-native": "^0.56.0",
"react-native-webrtc": "^1.58.3",

There seems to be no issue attaching the plugin and joining the specified room succeeds as per logs. However, any createOffer() on the plugin handle seems to fail without logging any errors whenever the value of 'audioSend' in the 'media' parameter doesn't evaluate to false. The implementation is based off of the audiobridgetest on github. The full code can be found here. I'm not sure what exactly causes the createOffer to fail but whenever 'audioSend' evaluates to false (either audio: false or audioSend: false), the createOffer succeeds and I get a response from Janus. I also get a warning 'Possible Unhandled Promise Rejection (id: 0):    Error: "i" is read-only' pointing to a position in the delta stack that is near impossible to trace and I'm not sure if it's related to the issue.

Any ideas as to debugging or fixing this would be greatly appreciated.

- Karan

jja...@gmail.com

unread,
Oct 15, 2018, 5:25:08 AM10/15/18
to meetecho-janus
Direct use of janus.es.js (or some React Native compatible variant of janus.js) will not work. 

Janus.js (or its package version in the case of React Native) is not directly compatible with react-native-webrtc. react-native-webrtc uses older versions of some webrtc interfaces. You need to change janus.js to use the older versions (addStream instead of addTrack, for example). In addition, you need to strip out some adapter.js related functionality. You need to debug the stuff very carefully. I would recommend using a simulator, not a real device for that debugging.

You are likely getting the unhandled promise because react-native-webrtc is not directly compatible with janus.js. 

Karan Modi

unread,
Oct 16, 2018, 2:12:37 AM10/16/18
to meetecho-janus
Since the streaming plugin works as expected, I don't think that this is a compatibility issue. I'm using a janus.nojquery.js file.

Lorenzo Miniero

unread,
Oct 16, 2018, 4:40:04 AM10/16/18
to meetecho-janus
We got rid of janus.noquery.js a ton of time ago, which means you're using a very old version.

Lorenzo

jja...@gmail.com

unread,
Oct 16, 2018, 12:22:47 PM10/16/18
to meetecho-janus
Well, in the code you are still using addStream, which is not present in the up-to-date Janus (as Lorenzo indicated). That is, however, present in the up-to-date react-native-webrtc. 

Upgrade your code. After the upgrade you have to solve the incompatibilities. 

I would really, really appreciate native (Swift I would prefer for iOS) libraries for Janus. Using React Native or Cordova is a real pain.

Karan Modi

unread,
Oct 18, 2018, 12:23:24 AM10/18/18
to meetecho-janus
Thank you and Lorenzo for the help. The code I'm working on was originally forked from this project. I'll replace janus.nojquery.js with the updated janus.js from github. Since I really couldn't find an update guide of sorts, is there any specific advice to keep in mind while attempting this task? I'll update the thread once I've made progress.

Karan

Lorenzo Miniero

unread,
Oct 18, 2018, 4:57:44 AM10/18/18
to meetecho-janus
I wasn't aware of that effort, I only new about Akinori's repo listed here:


I'm not sure what the state of that is, but at least it's more recent than your link.

On the Meetecho side, we definitely have no plan of doing anything on React: since it's a client side thing, this is something that's much easier done by someone else. We'll be glad to list any new effort in the Resources page as a reference for others.

Lorenzo

emalla...@gmail.com

unread,
Mar 25, 2019, 11:38:54 AM3/25/19
to meetecho-janus
Hi Modi,
did you figure out how to make audio bridge with React Native ? is there any github repo?

jja...@gmail.com

unread,
Mar 26, 2019, 1:34:02 PM3/26/19
to meetecho-janus


On Monday, 25 March 2019 17:38:54 UTC+2, emalla...@gmail.com wrote:
Hi Modi,
did you figure out how to make audio bridge with React Native ? is there any github repo?

Making the audiobridge plugin to work with React Native is very simple. Just set up the libraries for webrtc and make sure that the libraries are compiled properly. After that you have to modify the Janus-related files in order to accommodate the React Native libraries. 

I would recommend you to find out the incompatibilities by hand. There are only a few of them.

devil 2010

unread,
Aug 15, 2022, 6:35:17 AM8/15/22
to meetecho-janus

i need github repo
Vào lúc 00:34:02 UTC+7 ngày Thứ Tư, 27 tháng 3, 2019, jja...@gmail.com đã viết:
Reply all
Reply to author
Forward
0 new messages