opentok-react-native
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -94,3 +94,3 @@ ## Event Data | ||
changedProperty: '', | ||
} | ||
}; | ||
``` | ||
@@ -97,0 +97,0 @@ |
@@ -12,9 +12,25 @@ ### OTSession Component | ||
The `OTSession` component manages the connection to an OpenTok Session. It passes the sessionId to the `sessionId` prop to its child components. To disconnect the session, unmount the `OTSession` component. To publish and subscribe, you must nest `OTPublisher` and `OTSubscriber` inside `OTSession`: | ||
```javascript | ||
class App extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.sessionEventHandlers = { | ||
streamCreated: event => { | ||
console.log('Stream created!', event); | ||
}, | ||
streamDestroyed: event => { | ||
console.log('Stream destroyed!', event); | ||
}, | ||
}; | ||
} | ||
```html | ||
<OTSession apiKey="your-api-key" sessionId="your-session-id" token="your-session-token"> | ||
<OTPublisher style={{ width: 100, height: 100 }}/> | ||
<OTSubscriber style={{ width: 100, height: 100 }} /> | ||
</OTSession> | ||
render() { | ||
return ( | ||
<OTSession apiKey="your-api-key" sessionId="your-session-id" token="your-session-token" eventHandlers={this.sesssionEventHandlers}> | ||
<OTPublisher style={{ width: 100, height: 100 }}/> | ||
<OTSubscriber style={{ width: 100, height: 100 }} /> | ||
</OTSession> | ||
); | ||
} | ||
} | ||
``` | ||
@@ -21,0 +37,0 @@ |
{ | ||
"name": "opentok-react-native", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "React Native components for OpenTok iOS and Android SDKs", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -40,3 +40,3 @@ # opentok-react-native | ||
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. | ||
1. In you terminal, change into the `ios` directory of your React Native project. | ||
@@ -60,3 +60,3 @@ 2. Create a pod file by running: `pod init`. | ||
5. After installing the iOS SDK, change into your root directory of your project. | ||
5. After installing the OpenTok iOS SDK, change into your root directory of your project. | ||
@@ -84,8 +84,10 @@ 6. Now run, `react-native link opentok-react-native`. | ||
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. | ||
``` | ||
1. Go to Target | ||
2. Click on Build Phases | ||
3. Under the Link Binary With Libraries section, remove the libOpenTokReactNative.a and add it again | ||
### Android Installation | ||
1. In you terminal, change into your project directory. | ||
1. In your terminal, change into your project directory. | ||
@@ -92,0 +94,0 @@ 2. If you have already run `react-native link opentok-react-native` for the iOS installation, please skip this step. |
@@ -49,4 +49,6 @@ import { reassignEvents } from './OTHelper'; | ||
return { | ||
type: '', | ||
data: '', | ||
signal: { | ||
type: '', | ||
data: '', | ||
}, | ||
errorHandler: handleSignalError, | ||
@@ -56,4 +58,6 @@ }; | ||
return { | ||
type: validateString(signal.type), | ||
data: validateString(signal.data), | ||
signal: { | ||
type: validateString(signal.type), | ||
data: validateString(signal.data), | ||
}, | ||
errorHandler: typeof signal.errorHandler !== 'function' ? handleSignalError : signal.errorHandler, | ||
@@ -87,3 +91,3 @@ }; | ||
return "disconnecting"; | ||
case 5: | ||
case 5: | ||
return "failed"; | ||
@@ -90,0 +94,0 @@ } |
@@ -39,3 +39,3 @@ import React, { Component, Children, cloneElement } from 'react'; | ||
const signalData = sanitizeSignalData(value); | ||
OT.sendSignal(signalData, signalData.errorHandler); | ||
OT.sendSignal(signalData.signal, signalData.errorHandler); | ||
} | ||
@@ -50,3 +50,3 @@ }; | ||
createSession(credentials) { | ||
OT.initSession(credentials.apiKey, credentials.sessionId); | ||
OT.initSession(credentials.apiKey, credentials.sessionId); | ||
OT.connect(credentials.token, (error) => { | ||
@@ -64,3 +64,3 @@ if (error) { | ||
const signalData = sanitizeSignalData(this.props.signal); | ||
OT.sendSignal(signalData, signalData.errorHandler); | ||
OT.sendSignal(signalData.signal, signalData.errorHandler); | ||
} | ||
@@ -75,3 +75,3 @@ }); | ||
handleError(disconnectError); | ||
} else { | ||
} else { | ||
const events = sanitizeSessionEvents(this.props.eventHandlers); | ||
@@ -88,3 +88,3 @@ removeNativeEvents(events); | ||
const { style } = this.props; | ||
if (this.props.children) { | ||
@@ -91,0 +91,0 @@ const childrenWithProps = Children.map( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
207695
61
732
128