Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support react-native-webrtc #5

Open
ibc opened this issue Nov 6, 2017 · 26 comments

Comments

@ibc
Copy link
Member

commented Nov 6, 2017

@ibc ibc self-assigned this Nov 6, 2017

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jan 3, 2018

Working on it: db3528d

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jan 5, 2018

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jan 6, 2018

So the first problem may have been bypassed with this commit: d77f4a4

@versatica versatica deleted a comment from thehappycoder Jan 8, 2018

@versatica versatica deleted a comment from thehappycoder Jan 8, 2018

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jan 8, 2018

Another big limitation in react-native-webrtc: Cannot use a new create MediaStream to display a local or remote video track

Basically react-native-webrtc assumes that the only stream objects that the app is gonna use are those streams generated by react-native-webrtc (via getUserMedia or setRemoteDescription).

This is a heavy limitation for mediasoup-client which is not designed to depend on the original MediaStream at all. So bad news.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jan 22, 2018

NOTE: mediasoup-client 2.0.7 works with react-native-webrtc but it requires some changes in react-native-webrtc due to this issue.

We'll work on fixing it within the react-native-webrtc project.

@nxz91

This comment has been minimized.

Copy link

commented Apr 7, 2018

Hi @ibc, when you say it works you mean it works without modifications except video tracks? Audio connections should be fine?

@ibc

This comment has been minimized.

Copy link
Member Author

commented Apr 7, 2018

I think so.

@nxz91

This comment has been minimized.

Copy link

commented Apr 20, 2018

This is what I get: Unable to resolve module "events" .../node_modules/mediasoup-client/lib-es5/EnhancedEventEmitter.js: Module does not exist in the module map"
Any idea?

@nxz91

This comment has been minimized.

Copy link

commented Apr 20, 2018

A few fun facts:

...,
    "mediasoup-client": "^2.0.16",
    "react": "16.2.0",
    "react-native": "0.52.0",
    "react-native-webrtc": "^1.58.3",
  }
@nxz91

This comment has been minimized.

Copy link

commented Apr 21, 2018

Hi Iñaki,

Okay, I just did yarn add events to not get this issue any more. I also had to import * as mediasoupClient from 'mediasoup-client' instead of simply import mediasoupClient from 'mediasoup-client'.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2018

The former is a real fix. Indeed the "events" module is required. It just happens that browserify includes it, but webpack doesn't. It will be added.

The second problem is a bad ES6 module usage in your code ;)

@ibc

This comment has been minimized.

Copy link
Member Author

commented Apr 24, 2018

@nxz91: mediasoup-client 2.0.17 includes the "events" module. Thanks for reporting.

@sachalegrand

This comment has been minimized.

Copy link

commented Jul 10, 2018

@ibc Hello, so is it currently possible to have a react-native app connect to a mediasoup server using react-native-webrtc and mediasoup-client, as of today?

@versatica versatica deleted a comment from herlarb Jul 10, 2018

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jul 10, 2018

@sachalegrand no, sorry. Check #5 (comment).

The patch to apply in react-native-webrtc is somewhere in a thread in the mediasoup mailing list.

@Sharcoux

This comment has been minimized.

Copy link

commented Nov 6, 2018

I made a PR about it just now.

@ibc

This comment has been minimized.

Copy link
Member Author

commented May 7, 2019

react-native-webrtc is not gonna evolve at all and will remain using the WebRTC API of 2003 (poorly implemented) for long. We may take a different approach as explained here:

versatica/libmediasoupclient#40

@philjoseph

This comment has been minimized.

Copy link

commented Jun 17, 2019

I am planning to use WebRTC only for audio and may be also pictures but not video. Is mediasoup with react-native-webrtc with the patch an appropriate solution, do you believe ? Shall we better help you developing your react-native client lib as posted in versatica/libmediasoupclient#40 ?

@ibc

This comment has been minimized.

Copy link
Member Author

commented Jun 17, 2019

I'm on holidays for two weeks and have lot of mediasoup related work after it. Ping here after some weeks and will discuss it again. Right now I don't have any idea of why the proper way to go is.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Aug 21, 2019

Hi, after the excellent work by @saghul in react-native-webrtc 1.75.0, I've modernized mediasoup-client v3 for React-Native.

In theory, no external hacks are needed. The application can now create MediaStream instances safely, call addTrack() on them with remote tracks provided by consumer.track, etc.

@saghul

This comment has been minimized.

Copy link

commented Aug 21, 2019

👍

FTR there is no way to detect the react-native-webrtc version so I suggest you just put a comment saying that >= 1.75 is required.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Aug 30, 2019

Related to #86:

mediasoup-client won't include the whole react-native-webrtc as dependency, that would be terribly inappropriate.

@saghul can you help please? The problem seems to be that mediasoup-client depends on RTCPeerConnection, RTCSessionDescription and MediaStream in the global namespace.

  • mediasoup-client cannot (or should not) call require("react-native-webrtc") internally.
  • Does react-native-webrtc expose some API to pollute the global namespace?
  • Or perhaps the ReactNative.js handler could dynamically use const { RTCPeerConnection } = require("react-native-webrtc"), etc when needed? (so it would throw just in runtime if react-native-webrtc is not found)?
    • Is it a good practice to depend on runtime require() semantics within React-Native? or is it a super hack?

Other than that, any suggestion on what the best way to go is? A hack coming to my mind:

  • Document that the application must require "react-native-webrtc" and pollute the global namespace before it creates a mediasoup-client Device instance.
@saghul

This comment has been minimized.

Copy link

commented Aug 30, 2019

I’d say ReactNative.js should require it. You could have react-native-WebRTC as an optional dependency perhaps.

@saghul

This comment has been minimized.

Copy link

commented Aug 30, 2019

I do think that adding some API for exporting stuff as globales makes sense, I’ll do that too.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Aug 30, 2019

I’d say ReactNative.js should require it. You could have react-native-WebRTC as an optional dependency perhaps.

Optional deps do not work "fine". I don't want that react-native-webrtc is installed if I use npm to add mediasoup-client into my web project.

@ibc

This comment has been minimized.

Copy link
Member Author

commented Aug 30, 2019

I do think that adding some API for exporting stuff as globales makes sense, I’ll do that too.

In cordova-plugin-iosrtc we exposed iosrtc.registerGlobals().

@ibc

This comment has been minimized.

Copy link
Member Author

commented Aug 30, 2019

Just in case I've opened an issue in react-native-webrtc project: react-native-webrtc/react-native-webrtc#685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants
You can’t perform that action at this time.