Catalog npm
Back to packageRELEASE DETAILS

1.75.3

npm

555-webrtc

WebRTC for 555 Rtc React Native Sdk

androidiosreact-componentreact-nativewebrtc
Published18 Sept 2020
Direct dependencies5
Transitive dependenciesNot calculated

README

Current package documentation

react-native-webrtc

npm version npm downloads

A WebRTC module for React Native.

  • Support iOS / Android.
  • Support Video / Audio / Data Channels.

NOTE for Expo users: this plugin doesn't work unless you eject.

Community

Everyone is welcome to our Discourse community to discuss any React Native and WebRTC related topics.

WebRTC Revision

react-native-webrtcWebRTC Versionarch(ios)arch(android)npm publishednotes
1.75.2M75x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:heavy_check_mark:
1.75.1M75x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:heavy_check_mark:
1.75.0M75x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:heavy_check_mark:
1.69.2M69x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:heavy_check_mark:
1.69.1M69
commit
(24012)
(+16-24348)
x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:heavy_check_mark:
1.69.0M69
commit
(24012)
(+16-24348)
x86_64
i386
armv7
arm64
armeabi-v7a
x86
:heavy_check_mark:
masterM75x86_64
i386
armv7
arm64
armeabi-v7a
arm64-v8a
x86
x86_64
:warning:Please test!

Please see wiki page about revision history.

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.

import {
  RTCPeerConnection,
  RTCIceCandidate,
  RTCSessionDescription,
  RTCView,
  MediaStream,
  MediaStreamTrack,
  mediaDevices,
  registerGlobals
} from 'react-native-webrtc';

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

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

let isFront = true;
mediaDevices.enumerateDevices().then(sourceInfos => {
  console.log(sourceInfos);
  let videoSourceId;
  for (let i = 0; i < sourceInfos.length; i++) {
    const sourceInfo = sourceInfos[i];
    if(sourceInfo.kind == "videoinput" && sourceInfo.facing == (isFront ? "front" : "environment")) {
      videoSourceId = sourceInfo.deviceId;
    }
  }
  mediaDevices.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 => {
    // Got stream!
  })
  .catch(error => {
    // Log error
  });
});

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

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

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

RTCView

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

Rendering RTCView.

<RTCView streamURL={this.state.stream.toURL()}/>
NameTypeDefaultDescription
mirrorbooleanfalseIndicates whether the video specified by "streamURL" should be mirrored during rendering. Commonly, applications choose to mirror theuser-facing camera.
objectFitstring'contain'Can be contain or cover
streamURLstring''This is mandatory
zOrdernumber0Similarly to zIndex

Custom APIs

registerGlobals()

By calling this method the JavaScript global namespace gets "polluted" with the following additions:

  • navigator.mediaDevices.getUserMedia()
  • navigator.mediaDevices.enumerateDevices()
  • window.RTCPeerConnection
  • window.RTCIceCandidate
  • window.RTCSessionDescription
  • window.MediaStream
  • window.MediaStreamTrack

This is useful to make existing WebRTC JavaScript libraries (that expect those globals to exist) work with react-native-webrtc.

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.

VideoTrack.enabled

Starting with version 1.67, when setting a local video track's enabled state to false, the camera will be closed, but the track will remain alive. Setting it back to true will re-enable the camera.

react-native-incall-manager

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

react-native-callkeep

Use react-native-callkeep to use callkit on iOS or connection service on Android to have native dialer with your webrtc application.

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.

Creator

This repository is originally created by Wan Huang Yang.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 5

Native requirements
5 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
uuid
Environment
{
  "local_name": "uuid",
  "alias": false,
  "peer_metadata": null
}
^3.3.2runtime
base64-js
Environment
{
  "local_name": "base64-js",
  "alias": false,
  "peer_metadata": null
}
^1.1.2runtime
prop-types
Environment
{
  "local_name": "prop-types",
  "alias": false,
  "peer_metadata": null
}
^15.5.10runtime
event-target-shim
Environment
{
  "local_name": "event-target-shim",
  "alias": false,
  "peer_metadata": null
}
^1.0.5runtime
react-native
Environment
{
  "local_name": "react-native",
  "alias": false,
  "peer_metadata": null
}
>=0.40.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "80966c8786c1a539d152f867b7fc2aaf665379d3",
  "tarball": "https://registry.npmjs.org/555-webrtc/-/555-webrtc-1.75.3.tgz",
  "fileCount": 162,
  "integrity": "sha512-MQXSWX8F8EgjXNzTFVgh6nA/+3KSV5+JCWP19v/xS4ncdhBgZfJLMWMOAlFFQ2VRMsvz/1ULl0FDWnPZY/mjuw==",
  "signatures": [
    {
      "sig": "MEYCIQCI+EOSvfyfZ1wW+S0WxRW52Y0LFfswQH4cIGbzhlF5mwIhAP2mutqMspOfq+NvqdgFOEWH+dAk/gJdabEYFTPiLKp5",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 75019137,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZRN7CRA9TVsSAnZWagAAYqsP/RLHMlnbItB16p1yEXDa\nB2BjcQZMV2SXBOcX0OsToeQ7pwEU3f5ATq8LkrIx1LGLkiMgS1hFCutCrg0n\nSbLlWsHS7USrJyssbH1OKaWTO7n6B94ervOAqDqUKyXurjhRyMOYGWxwI3O8\nMhvlCCdqCDgqJH5Xl0wuHMIsr0qNxvicyNJp4rp6u/TAo2whiybaEvrFlWEz\nByUaFZTlBmkD0COWSfoFKdB2l2UhJzjvA1wkmW+Rko+Ecc2RQIYCLG/BtgYs\ntN6im8MjOOJRQ2emI27UxRRIJGrJ/2IeKWUwT1x/IaOaNEwIPClJRmnN3efK\n1ZDZtk1qNJWnn6LX+Fm8/hfnwBkWluVBnt1Qkb34CmxeuX8hI1xHq4WTA7p3\n6aDxD0z4qzKXcp8DliUosuCJzKF8y/TDRx+G4C6l2uh0E4OplFnM3vFjFLcG\nx9cjD5k3LsEsIUz9Z5fD5Eb8eIxQuc8woP4LuDpGqpFeJejYpeQgB0oDzwH7\n5LrJ+aOy+tWqsiIcs5rBRTcmriSFDL66fqQrrLu9IModU01FV70J5A/qw1/Q\nuOzQWAtV8IxnV0kqdt6fM/NnJfKm3dPYN3m5SzyH2RMRx8jYfQzQKJ/1tklJ\ny5QX3DQ/X9qqRijrlqahwbLyM6tBIsseiHkP13oAO+VHw/bkNR9mDinI8G55\nfxJg\r\n=fM1I\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
555platform/react-native-555-webrtc

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:25 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a77c90cf7de0d857aeaeeea4378b9f44bc9a896a1df8d285e6e2660544b0a76f

Other collected versions

View all collected versions →