Package Exports
- opentok-react-native
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (opentok-react-native) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
opentok-react-native

React Native library for OpenTok iOS and Android SDKs
- Pre-Requisites
- Installation
- API Reference
- Samples
- Contributing
In this repo, you'll find the OpenTok React Native library:
Pre-Requisites:
- React Native iOS installation instructions
- Install and update Android Studio
- React Native Android installation instructions
Installation:
In your terminal, change into your React Native project's directory
In your terminal, run
npm install opentok-react-native
iOS Installation
Note Please make sure to have CocoaPods on your computer.
In you terminal, change into your
iosdirectory.Create a pod file by running:
pod init.Add the following to your pod file:
platform :ios, '9.0'
target '<YourProjectName>' do
use_frameworks!
# Pods for <YourProject>
pod 'OpenTok'
end
Now run,
pod installOpen XCode
Open
<YourProjectName>.xcworkspacefile in XCode. This file can be found in theiosfolder of your React Native project.Click
FileandAdd Files toAdd the following files from
../node_modules/opentok-react-native/iosto the project:
OTPublisher.hOTPublisher.mOTPublisherManager.swiftOTPublisherView.swiftOTRN.swiftOTScreenCapturer.swiftOTSessionManager.mOTSessionManager.swiftOTSubscriber.hOTSubscriber.mOTSubscriberManager.swiftOTSubscriberView.swift
Click
Create Bridging Headerwhen you're prompted with the following modal:Would you like to configure an Objective-C bridging header?Add the contents from the
Bridging-Header.hfile in../node_modules/opentok-react-native/iosto<YourProjectName>-Bridging-Header.hEnsure you have enabled both camera and microphone usage by adding the following entries to your
Info.plistfile:
<key>NSCameraUsageDescription</key>
<string>Your message to user when the camera is accessed for the first time</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your message to user when the microphone is accessed for the first time</string>Android Installation
In you terminal, change into your project directory.
Run
react-native link opentok-react-nativeOpen your Android project in Android Studio.
Add the following to your project
build.gradlefile:
maven {
url "http://tokbox.bintray.com/maven"
}- It should look something like this:

Sync Gradle
Make sure the following in your app's gradle
compileSdkVersion,buildToolsVersion,minSdkVersion, andtargetSdkVersionare the same in the OpenTok React Native library.As for the older Android devices, ensure you add camera and audio permissions to your
AndroidManifest.xmlfile:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="true" />Newer versions of Android–API Level 23 (Android 6.0)–have a different permissions model that is already handled by this library.
Samples
To see this library in action, check out the opentok-react-native-samples repo.
Contributing
If you make changes to the project that you would like to contribute back then please follow the contributing guidelines. All contributions are greatly appreciated!