Skip to content

CommercialTribe/react-native-opentok

This branch is 46 commits ahead of, 170 commits behind callstack/react-native-opentok:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4b2a32c · Nov 18, 2016
Oct 12, 2016
Aug 17, 2016
Sep 1, 2016
Jul 27, 2016
Sep 26, 2016
Jul 27, 2016
Oct 11, 2016
Nov 14, 2016
Nov 14, 2016
Oct 6, 2016
Oct 11, 2016
Nov 14, 2016
Nov 14, 2016
Nov 18, 2016
Oct 11, 2016
Oct 11, 2016
Oct 17, 2016
Nov 18, 2016
Jul 27, 2016
Oct 17, 2016
Aug 11, 2016
Oct 12, 2016
Jul 27, 2016
Aug 16, 2016
Jul 27, 2016
Jul 27, 2016
Nov 18, 2016
Aug 17, 2016
Sep 26, 2016
Jul 28, 2016
Oct 11, 2016
Oct 18, 2016
Oct 6, 2016
Oct 14, 2016

Repository files navigation

react-native-opentok

React Native SDK for OpenTok platform.

Installation

Requirements

  • RN >= 0.29.0

iOS

To install using Cocoapods, simply insert the following line into your Podfile and run pod install

pod 'react-native-opentok', :path => '../node_modules/react-native-opentok'

Android

  • In your android/app/build.gradle add:
...
dependencies {
  ...
  compile project(':react-native-opentok')
  compile 'com.opentok.android:opentok-android-sdk:2.8.+'
}
  • In your android/settings.gradle add:
...
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/android')
  • In your application object, add:
import io.callstack.react.opentok.MainPackage;
...

    @Override protected List<ReactPackage> getPackages() {
      return Arrays.asList(
          ...
          new MainPackage()
        );
    }

Props

Prop Type
apiKey string
sessionId string
token string
------------ -------------
spinnerContainerStyle object
------------ -------------
onPublishStart function
onPublishError function
onPublishStop function
onSessionDidConnect function
onSessionDidDisconnect function
onArchiveStarted function
onArchiveStopped function
onPublishResumed function
------------ -------------
onSubscribeStart function
onSubscribeError function
onSubscribeStop function

Basic usage

Publisher

import { PublisherView } from 'react-native-opentok';

export default function Publisher() {
  return (
    <PublisherView
      apiKey={OPENTOK_API_KEY}
      sessionId={OPENTOK_SESSION_ID}
      token={OPENTOK_PUBLISHER_TOKEN}
      style={{ width: 300, height: 200 }}
    />
  );
}

Subscriber

import { SubscriberView } from 'react-native-opentok';

export default function Subscriber() {
  return (
    <SubscriberView
      apiKey={OPENTOK_API_KEY}
      sessionId={OPENTOK_SESSION_ID}
      token={OPENTOK_SUBSCRIBER_TOKEN}
      style={{ width: 300, height: 200 }}
    />
  );
}

Signaling

import { Session } from 'react-native-opentok';

Session.connect(OPENTOK_API_KEY, SESSION_ID, PUBLISHER_TOKEN || SUBSCRIBER_TOKEN);
Session.onMessageRecieved((e) => console.log(e));
Session.sendMessage('message');

Running example project

$ cd examples/Basic && npm i && npm start

callstack.io

About

React Native OpenTok

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 77.1%
  • Java 13.1%
  • JavaScript 9.0%
  • Ruby 0.8%