Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-opentok

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-opentok

  • 1.0.10
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

README

How do I set up?

  • In the root folder of your react-native project run
    npm install react-native-opentok --save
  • To link the library run
    rnpm link react-native-opentok
  • Install OpenTok using
pod 'OpenTok'
    pod install

###SAMPLE USAGE###

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';

import OpenTok from 'react-native-opentok'
//URL to connect to session
var sampleServerBaseUrl = 'https://calm-ridge-14798.herokuapp.com',
sessionCredentialsUrl = sampleServerBaseUrl + '/session',
startArchiveUrl = sampleServerBaseUrl + '/start/',
stopArchiveUrl = sampleServerBaseUrl + '/stop/';

const TestView = React.createClass ({

getInitialState() {
return ({
apiKey: null,
sessionId: null,
token: null,
doConnect: false
});
},

componentWillMount() {
//To start the OpenTok session, call this function
this.getApiKeyAndToken();
},

getApiKeyAndToken() {
var xhr = new XMLHttpRequest();
xhr.open("GET", sessionCredentialsUrl, true);
var self = this;
xhr.onload = function (e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
openTokSessionInfo = JSON.parse(xhr.responseText);
self.setState({
apiKey: openTokSessionInfo.apiKey,
sessionId: openTokSessionInfo.sessionId,
token: openTokSessionInfo.token
doConnect: true
});
} else {
console.log(xhr.statusText);
}
}
};
xhr.onerror = function (e) {
console.log(xhr.statusText);
};
xhr.send(null);
},

didDisconnect() {
//Callback function
},

render() {
return (
<View style={styles.container}>
<OpenTok doConnect={this.state.doConnect} apiKey={this.state.apiKey} sessionId={this.state.sessionId} token={this.state.token}/>
</View>
);
}
});

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});

AppRegistry.registerComponent('test', () => TestView);

FAQs

Package last updated on 18 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc