npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-hot-box

v1.5.4

Published

![HOTBOX LOGO](http://i.imgur.com/495tedr.png)

Downloads

17

Readme

HotBox

HOTBOX LOGO

npm

HotBox is a React Native wrapper around TokBox OpenTOK SDK.

I tried the other React Native OpenTOK wrappers but they did not seem to work / provide the flexibility we wanted so we created our own.

Installation

iOS

  1. yarn add react-native-hot-box or inferiorly npm install --save react-native-hot-box
  2. Add the files under node_modules/react-native-hot-box/HotBoxService (In Xcode: File -> Add files to "App Name")
  3. You're going to want a bridging header:
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>
#import <React/RCTViewManager.h>
  1. 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
  1. Investigate Example for a full example just in case something is missing or open a ticket.

Android

Please open a PR :)

Usage

Something like:

import {Session, PublisherView, SubscriberView} from 'react-native-hot-box'
	
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

<PublisherView style={styles.viewStyle} />

Subscriber

<SubscriberView style={styles.viewStyle} streamId={streamId} />

Example Houseparty Clone

To run:

  1. yarn install
  2. cd Example/ios & pod install
  3. open Example/ios/Example.xcworkspace
  4. Add your api key, token and session key in App.js
  5. run

Credits

Thanks to my team:

  • @george-lim
  • @jyliang

Thanks to the following projects for inspiration!

  • https://github.com/callstack-io/react-native-opentok
  • https://github.com/tokboxnerds/opentok-react-native

Issues?

Feel free to open an issue, submit a PR or email [email protected] to give feedback / suggestions.