Skip to content
config: iOS/Android, react-native: 0.59.4, react-native-webrtc: 1.67.1 working example with server
JavaScript Objective-C Starlark Java
Branch: master
Clone or download
Latest commit deac10f Feb 17, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ configuration for android Apr 17, 2019
android update gradle Feb 17, 2020
ios first commit Apr 16, 2019
src update gradle Feb 17, 2020
.buckconfig first commit Apr 16, 2019
.flowconfig first commit Apr 16, 2019
.gitattributes first commit Apr 16, 2019
.gitignore first commit Apr 16, 2019
.watchmanconfig first commit Apr 16, 2019
README.md configuration for android Apr 17, 2019
app.json first commit Apr 16, 2019
babel.config.js first commit Apr 16, 2019
index.js configuration for android Apr 17, 2019
metro.config.js first commit Apr 16, 2019
package-lock.json update gradle Feb 17, 2020
package.json update gradle Feb 17, 2020

README.md

RCTWebRTCDemo2

Configuration (Works on iOS & Android)

react: 16.8.3

react-native: 0.59.4

react-native-webrtc: 1.67.1

Usage

  • Clone the repository, run npm install.
  • For iOS, run the project on Xcode.
  • For Android, run react-native run-android in the directory.

Native Code Changes (Android)

  • Because this is version 1.67.1 you must change the native android code in the module.
  • go to node_modules/react-native-webrtc/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.module.annotations.ReactModule; // <-- Add this

import java.util.ArrayList;
import java.util.HashMap;

import org.webrtc.*;

@ReactModule(name = "WebRTCModule") // <-- Add this
public class WebRTCModule extends ReactContextBaseJavaModule {
    static final String TAG = WebRTCModule.class.getCanonicalName();

Instructions

  • For this to work you need to create the server, go to : RCTWebRTCDemo-server and follow the instructions.

  • After you create the server and deploy it with ngrok copy the link, something like that "https://a4cd7858.ngrok.io" and paste it to RCTWebRCTDemo2/src/App.js

const url = 'paste_it_here';
  • It must look like than
const url = 'https://a4cd7858.ngrok.io/';

Note

  • Whenever you change the ngrok link you must follow the same routine.
You can’t perform that action at this time.