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

ReactNative: Requiring RTCPeerConnection, RTCSessionDescription, and MediaStream #86

Closed
wants to merge 1 commit into from

Conversation

jasonkang14
Copy link

@ibc I am not sure where there is an error while building a project in React Native because it worked perfectly when I tried your example with Chrome.

If you don't require RTCPeerConnection, RTCSessionDescription, and MediaStream, it throws an error saying that those three are not defined.

Since you have worked hard to make mediasoup compatible with react-native-webrtc, I required RTCPeerConnection, RTCSessionDescription, and MediaStream from react-native-webrtc and got it to work. Please let me know if you think there is a better way to deal with the problem.

RTCPeerConnection error

@jasonkang14 jasonkang14 changed the title Requiring RTCPeerConnection, RTCSessionDescription, and MediaStream ReactNative: Requiring RTCPeerConnection, RTCSessionDescription, and MediaStream Aug 30, 2019
@ibc
Copy link
Member

ibc commented Aug 30, 2019

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.

@ibc ibc mentioned this pull request Aug 30, 2019
@ibc
Copy link
Member

ibc commented Aug 30, 2019

I'll close this PR. Let's continue the discussion in the already existing issue about react-native-webrtc:

#5 (comment)

@ibc ibc closed this Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants