Skip to content

spritlesoftware/opentok-react-native

 
 

Repository files navigation

opentok-react-native

OpenTok Labs

React Native library for OpenTok iOS and Android SDKs

In this repo, you'll find the OpenTok React Native library:

Pre-Requisites:

  1. Install node.js

  2. Install and update Xcode (you will need a Mac)

  1. Install and update Android Studio

Installation:

  1. In your terminal, change into your React Native project's directory

  2. In your terminal, run npm install opentok-react-native

iOS Installation

Note: Please make sure to have CocoaPods on your computer. If you've installed this package before, you may need to edit your Podfile and project structure because the installation process has changed.

  1. In you terminal, change into your ios directory.

  2. Create a pod file by running: pod init.

  3. Add the following to your pod file:

    platform :ios, '9.0'

    target '<YourProjectName>' do

      # Pods for <YourProject>
        pod 'OpenTok', '2.14.0'
    end

  1. Now run, pod install

  2. After installing the iOS SDK, change into your root directory of your project.

  3. Now run, react-native link opentok-react-native.

  4. Open <YourProjectName>.xcworkspace file in XCode. This file can be found in the ios folder of your React Native project.

  5. Click File and New File

  6. Add an empty swift file to your project:

    • You can name this file anything i.e: OTInstall.swift. This is done to set some flags in XCode so the Swift code can be used.
  7. Click Create Bridging Header when you're prompted with the following modal: Would you like to configure an Objective-C bridging header?

  8. Ensure you have enabled both camera and microphone usage by adding the following entries to your Info.plist file:

<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>

If you try to archive the app and it fails, please do the following:

   Go to Target -> Build Phases and add OpenTokReactNative under Target Dependencies. After that go to the Link Binary With Libraries section and remove the libOpenTokReactNative.a and add it again.

Android Installation

  1. In you terminal, change into your project directory.

  2. If you have already run react-native link opentok-react-native for the iOS installation, please skip this step.

    • Run react-native link opentok-react-native
  3. Open your Android project in Android Studio.

  4. Add the following to your project build.gradle file:

        maven {
            url "http://tokbox.bintray.com/maven"
        }
  • It should look something like this:
  1. Sync Gradle

  2. Make sure the following in your app's gradle compileSdkVersion, buildToolsVersion, minSdkVersion, and targetSdkVersion are the same in the OpenTok React Native library.

  3. As for the older Android devices, ensure you add camera and audio permissions to your AndroidManifest.xml file:

    <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!

About

OpenTok React Native - a library for OpenTok iOS and Android SDKs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 40.1%
  • Swift 33.0%
  • JavaScript 22.6%
  • Objective-C 4.3%