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-webrtc-usb

v0.0.2

Published

WebRTC for React Native with android usb camera

Downloads

6

Readme

react-native-webrtc-usb

forked from https://github.com/oney/react-native-webrtc usb just for android.

npm version npm downloads

A WebRTC module for React Native.

BREAKING FOR RN 40:

master branch needs RN >= 40 for now. if your RN version is under 40, use branch rn-less-40 (npm version 0.54.7)

see #190 for detials

Support

  • Currently support for iOS and Android.
  • Support video and audio communication.
  • Supports data channels.
  • You can use it to build an iOS/Android app that can communicate with web browser.

WebRTC Revision

Since 0.53, we use same branch version number like in webrtc native. please see wiki page about revision history

format:

${branch_name} stable (${branched_from_revision})(+${Cherry-Picks-Num}-${Last-Cherry-Picks-Revision})

  • the webrtc revision in brackets is extracting frrom Cr-Branched-From instead Cr-Commit-Position
  • the number follows with + is the additional amount of cherry-picks since Branched-From revision.

note:

the order of commit revision is nothing to do with the order of cherry-picks, for example, the earlier committed cherry-pick-#2 may have higher revision than cherry-pick-#3 and vice versa.

| react-native-webrtc | WebRTC Version | arch(ios) | arch(android) | npm published | note | additional picks | | :-------------: | :-------------:| :-----: | :-----: | :-----: | :-----: | :-----: | | 0.54.7 | M54(13869)(+6-14091) | x86_64i386armv7arm64 | armeabi-v7ax86 | :heavy_check_mark: | RN < 40 | | | 1.57.1 | M57(16123)(+7-16178) | x86_64i386armv7arm64 | armeabi-v7ax86 | :heavy_check_mark: | |* 16805* 16462 | | 1.58.3| M58commit(16937)(+21-18206) | x86_64i386armv7arm64 | armeabi-v7ax86 | :heavy_check_mark: | :sparkles: Promise Support :sparkles: | * 17065* 17925* 18140* 18277 | | master| M58commit(16937)(+21-18206) | x86_64i386armv7arm64 | armeabi-v7ax86 | :warning: | test me plz | * 17065* 17925* 18140* 18277 |

Installation

react-native-webrtc:

note: 0.10.0~0.12.0 required git-lfs, see: git-lfs-installation

Usage

Now, you can use WebRTC like in browser. In your index.ios.js/index.android.js, you can require WebRTC to import RTCPeerConnection, RTCSessionDescription, etc.

var WebRTC = require('react-native-webrtc');
var {
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  getUserMedia,
} = WebRTC;

Anything about using RTCPeerConnection, RTCSessionDescription and RTCIceCandidate is like browser.
Support most WebRTC APIs, please see the Document.

var configuration = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}]};
var pc = new RTCPeerConnection(configuration);

let isFront = true;
MediaStreamTrack
  .getSources()
  .then(sourceInfos => {
    console.log(sourceInfos);
    let videoSourceId;
    for (let i = 0; i < sourceInfos.length; i++) {
      const sourceInfo = sourceInfos[i];
      if(sourceInfo.kind == "video" && sourceInfo.facing == (isFront ? "front" : "back")) {
        videoSourceId = sourceInfo.id;
      }
    }
    return getUserMedia({
      audio: true,
      video: {
        mandatory: {
          minWidth: 500, // Provide your own width, height and frame rate here
          minHeight: 300,
          minFrameRate: 30
        },
        facingMode: (isFront ? "user" : "environment"),
        optional: (videoSourceId ? [{sourceId: videoSourceId}] : [])
      }
    });
  })
  .then(stream => {
    console.log('dddd', stream);
    return stream
  })
  .catch(logError);

pc.createOffer()
  .then(pc.setLocalDescription)
  .then(() => {
    // Send pc.localDescription to peer
  })
  .catch(logError);

pc.onicecandidate = function (event) {
  // send event.candidate to peer
};

// also support setRemoteDescription, createAnswer, addIceCandidate, onnegotiationneeded, oniceconnectionstatechange, onsignalingstatechange, onaddstream

However, render video stream should be used by React way.

Rendering RTCView.

var container;
var RCTWebRTCDemo = React.createClass({
  getInitialState: function() {
    return {videoURL: null};
  },
  componentDidMount: function() {
    container = this;
  },
  render: function() {
    return (
      <View>
        <RTCView streamURL={this.state.videoURL}/>
      </View>
    );
  }
});

And set stream to RTCView

container.setState({videoURL: stream.toURL()});

Custom APIs

MediaStreamTrack.prototype._switchCamera()

This function allows to switch the front / back cameras in a video track on the fly, without the need for adding / removing tracks or renegotiating.

Demos

Official Demo

author: @oney

The demo project is https://github.com/oney/RCTWebRTCDemo
And you will need a signaling server. I have written a signaling server https://react-native-webrtc.herokuapp.com/ (the repository is https://github.com/oney/react-native-webrtc-server).
You can open this website in browser, and then set it as signaling server in the app, and run the app. After you enter the same room ID, the video stream will be connected.

Demo by Folks

author: @thoqbk

  • Signaling server and web app: https://rewebrtc.herokuapp.com/ (the repository is https://github.com/thoqbk/rewebrtc-server)
  • React native app repository: https://github.com/thoqbk/rewebrtc

Native control

Use react-native-incall-manager to keep screen on, mute microphone, etc.

Sponsorship

This repository doesn't have a plan to get sponsorship.(This can be discussed afterwards by collaborators). If you would like to pay bounty to fix some bugs or get some features, be free to open a issue that adds [BOUNTY] category in title. Add other bounty website link like this will be better.