<commit_before># react-native-webrtc

A WebRTC module for React Native.

## Support
Currently support for iOS only.  
Support video and audio communication. Not support DataChannel now.  
You can use it to build an app that can communicate with web browser.  
The iOS Library is based on libWebRTC.a(It's build by [webrtc-build-scripts](https://github.com/pristineio/webrtc-build-scripts) and you can download it [here](https://cocoapods.org/pods/libjingle_peerconnection))

## Installation

1.) Run `react-native init RCTWebRTCDemo` to create your react native project. (RCTWebRTCDemo can be any name you like)   
2.) `npm install react-native-webrtc --save`  
3.) Open `RCTWebRTCDemo/node_modules/react-native-webrtc`  
4.) Drag `RCTWebRTC` directory to you project. Uncheck `Copy items if needed` and select `Added folders: Create groups`  
![Picture 1](http://i.imgur.com/NRHANSq.jpg)
![Picture 2](http://i.imgur.com/8fX2fDM.jpg)
![Picture 3](http://i.imgur.com/vVDTIXD.jpg)  
5.) Select your target, select `Build Phases`, open `Link Binary With Libraries`, add these libraries  
```
AVFoundation.framework
AudioToolbox.framework
CoreGraphics.framework
GLKit.framework
CoreAudio.framework
CoreVideo.framework
VideoToolbox.framework
libc.tbd
libsqlite3.tbd
libstdc++.tbd
```
![Picture 4](http://i.imgur.com/hHNfKkZ.jpg)  
6.) select `Build Settings`, find `Library Search Paths`, add `$(SRCROOT)/../node_modules/react-native-webrtc` with `recursive` 
![Picture 5](http://i.imgur.com/L3QkvzG.jpg)  
7.) Maybe you have to set `Dead Code Stripping` to `No` and `Enable Bitcode` to `No`.

## Usage
Now, you can use WebRTC like in browser.
In your index.ios.js, you can require WebRTC to import RTCPeerConnection, RTCSessionDescription, etc.
```javascript
var WebRTC = require('react-native-webrtc');
var {
  RTCPeerConnection,
  RTCMediaStream,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView
} = WebRTC;
```
Anything about using RTCPeerConnection, RTCSessionDescription and RTCIceCandidate is like browser. However, render video stream should be used by React way.

Rendering RTCView.
```javascript
var container;<commit_msg>Link iOS Installation<commit_after># react-native-webrtc

A WebRTC module for React Native.

## Support
Currently support for iOS only.  
Support video and audio communication. Not support DataChannel now.  
You can use it to build an app that can communicate with web browser.  
The iOS Library is based on libWebRTC.a(It's build by [webrtc-build-scripts](https://github.com/pristineio/webrtc-build-scripts) and you can download it [here](https://cocoapods.org/pods/libjingle_peerconnection))

## Installation

### [iOS](https://github.com/oney/react-native-webrtc/blob/master/Documentation/iOSInstallation.md)

## Usage
Now, you can use WebRTC like in browser.
In your index.ios.js, you can require WebRTC to import RTCPeerConnection, RTCSessionDescription, etc.
```javascript
var WebRTC = require('react-native-webrtc');
var {
  RTCPeerConnection,
  RTCMediaStream,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView
} = WebRTC;
```
Anything about using RTCPeerConnection, RTCSessionDescription and RTCIceCandidate is like browser. However, render video stream should be used by React way.

Rendering RTCView.
```javascript
var container;
{'fraction_non_alphanumeric': 0.1043956043956044, 'fraction_numerical': 0.004884004884004884, 'mean_word_length': 4.936594202898551, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '274699', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1014, 'n_words': 331}