Socket
Book a DemoInstallSign in
Socket

react-rtc

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rtc

React firebase webrtc mockup

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

react-rtc

react-rtc is a react component that uses firebase to establish webRTC connections.

Simple demo

Usage

/** @jsx React.DOM */
var Firebase = require('firebase');
var React = require('react');

var Rtc = require('react-rtc');

var myFirebaseRef = new Firebase('https://someFbApp.firebaseio.com');

var VideoComponent = React.createClass({
  componentWillReceiveProps: function(newProps) {
    if (this.props.remoteVideo !== newProps.remoteVideo)
      this.setState({src: URL.createObjectURL(newProps.remoteVideo)});
  },

  render: function() {
    return <video src={this.state.src} />
  }
});

// Then use it like this:

<Rtc id="myId" fb={myFirebaseRef}>
  <VideoComponent key="sharedKey">
  <VideoComponent key="anotherKeySharedWithAnotherClient">
</Rtc>

API

Rtc requires id and fb props. It can also take a component prop which decides what DOM element child components will render in. It will default to a DIV element. id must be unique amongst all clients/browsers who share the same firebase ref.

Child components require a key component. Whenever a child component in another browser has the same key, they will establish a webRTC connection, and the child will get two new props injected: localStream and remoteStream. These are webRTC media streams.

FAQs

Package last updated on 06 Oct 2014

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.