https://github.com/opengeekslab/rnopentok
https://github.com/opengeekslab/rnopentok
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/opengeekslab/rnopentok
- Owner: openGeeksLab
- Created: 2017-09-11T11:20:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T13:14:14.000Z (almost 9 years ago)
- Last Synced: 2025-01-09T17:54:59.863Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HotBox

React Native wrapper around [TokBox OpenTOK SDK](https://tokbox.com/).
### iOS
1. `yarn add https://github.com/mobileDevNativeCross/rnopentok.git` or inferiorly `npm install --save https://github.com/mobileDevNativeCross/rnopentok.git`
2. You're going to want a bridging header:
```
#import
#import
#import
```
3. You will also want a Podfile:
```
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Example' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'RxSwift'
pod 'OpenTok'
end
```
## Usage
Something like:
```
import {Session, PublisherView, SubscriberView} from 'rnopentok'
var session = new Session()
session.on('sessionDidConnect', () => console.log('connected'))
session.on("sessionDidDisconnect", () => console.log('disconnected'))
session.on('publisherStreamCreated', () => console.log("PUBLISHER CREATED"))
session.on('sessionStreamCreated', () => console.log('sessionStreamCreated'))
session.on('subscriberDidConnect', (streamId) => console.log("New subscriber", streamId))
session.on("subscriberDidDisconnect", (streamId) => console.log("Subscriber disconnected", streamId))
session.on('sessionStreamDestroyed', (streamId) => console.log("Stream destroyed", streamId))
let apiKey = ''
let sessionId = ''
let token = ''
session.createSession(apiKey, sessionId, token)
```
### Events
```
* sessionDidConnect (sessionId)
* sessionDidDisconnect (sessionId)
* sessionConnectionCreated (connectionId)
* sessionConnectionDestroyed (connectionId)
* sessionStreamCreated (streamId)
* sessionStreamDidFailWithError (err)
* sessionStreamDestroyed (streamId)
* sessionReceivedSignal ({type, connectionId, message})
* publisherStreamCreated (streamId)
* publisherStreamDidFailWithError (err)
* publisherStreamDestroyed (streamId)
* subscriberDidConnect (streamId)
* subscriberDidFailWithError (streamId)
* subscriberDidDisconnect (streamId)
```
### Methods
```
session.createSession(apiKey, sessionId, token)
session.createPublisher() // You can manually create the publisher but by default it's created automatically
session.disconnectAllSessions()
// Turn on/off video stream for given streamId (null for publisher)
session.requestVideoStream(streamId, on)
// Turn on/off audio stream for given streamId (null for publisher)
session.requestAudioStream(streamId, on)
// Flip publisher camera
session.requestCameraSwap(toBack) // toBack==true ==> back camera
//Send messages
session.sendMessage(type, message, connectionId)
session.broadcastMessage(type, message)
//Subscribe to Stream
session.subscribe(streamId)
//Subscribe to signals
session.on(event, handler)
```
### Views
#### Publisher
``
### Subscriber
``