{"_id":"@cylonix-meet/react-native-webrtc","name":"@cylonix-meet/react-native-webrtc","dist-tags":{"latest":"1.100.1"},"versions":{"1.100.1":{"name":"@cylonix-meet/react-native-webrtc","version":"1.100.1","repository":{"type":"git","url":"git+https://github.com/react-native-webrtc/react-native-webrtc.git"},"description":"WebRTC for React Native","license":"MIT","homepage":"https://github.com/react-native-webrtc/react-native-webrtc","keywords":["react-component","react-native","ios","android","webrtc"],"react-native":"src/index.ts","types":"lib/typescript/index.d.ts","main":"lib/commonjs/index.js","module":"lib/module/index.js","dependencies":{"base64-js":"1.5.1","event-target-shim":"6.0.2","tar":"6.1.11"},"peerDependencies":{"react-native":">=0.60.0"},"scripts":{"check":"tsc --noEmit","postinstall":"node tools/downloadWebRTC.js","prepare":"husky install && bob build"},"bugs":{"url":"https://github.com/react-native-webrtc/react-native-webrtc/issues"},"devDependencies":{"@types/react":"17.0.40","@types/react-native":"0.67.3","husky":"7.0.2","lint-staged":"11.2.3","prettier":"2.4.1","react-native-builder-bob":"0.18.2","typescript":"4.6.2"},"lint-staged":{"**/*":"prettier --write --ignore-unknown"},"react-native-builder-bob":{"source":"src","output":"lib","targets":["commonjs","module","typescript"]},"webrtc-builds":{"android":"https://gitlab.com/api/v4/projects/40701591/packages/generic/android-webrtc/100.0.1/android-webrtc.tgz","ios":"https://github.com/jitsi/webrtc/releases/download/v100.0.0/WebRTC.xcframework.tgz","ios-bitcode":"https://github.com/jitsi/webrtc/releases/download/v100.0.0/WebRTC.xcframework-bitcode.tgz"},"directories":{"example":"examples","lib":"lib"},"author":{"name":"Cylonix Authors"},"gitHead":"83710431a48921d5c8d5c0ae0445617f75defaed","_id":"@cylonix-meet/react-native-webrtc@1.100.1","_nodeVersion":"16.16.0","_npmVersion":"9.6.2","dist":{"integrity":"sha512-IZaBPRbpVoWsqZK5c3eZhPNZ2PWCP3stPEIEwA0yKKJ6uez+azJqS5zJS1TYjYYT978HRW9SzumBMZhmCOLEHg==","shasum":"53305123b3d2bfa87e2a92d1a2cf3bd848907d07","tarball":"https://registry.npmjs.org/@cylonix-meet/react-native-webrtc/-/react-native-webrtc-1.100.1.tgz","fileCount":224,"unpackedSize":657021,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG4Y6rBqVd1sTJHINT5520o5mI8KZQSfRv1dwYMyv8iLAiEA9WSq3lgvni98hDKdURLh3O4J3s506Cez9YidIHA2l2Y="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkFwgiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqX/w//Qin68/nNiXDTkXbGQQkwmCuj6EXoWi9ef/BGPu5sAzLOtSex\r\nlyFZvcMVHEGPsKitKpna54Z5JIXSMO1j+3HWjvc/qRMyKy9aG9fpMH4zq00B\r\nlVUNpLeg9zsaIMOZgKLciMKPRpZDnos253SZsaQ9jf6LsXt3cDXV+jsR2uK8\r\nXQEZT+Eml9kOee29SyUKCE/VGY2xTsFsoz/b96ag6j6VNdvv6A/wNJF44ZlU\r\nc0i8dXTrEno1MospEs1CUep4WFG8iEhPvPi9y5XL7tTvZLiLuzP0+SrW2uPL\r\n+BODFIARdczd4XL6D79hJb6E8QN5T0O9vfH0kwlBcqQeHmY4vS9FvG4bs9Tn\r\nbPy1yxHPdaZAJ7xiO/mvU2WgeGlwS7Io26ZSf95km/omReUU3GrgNc0T9JOG\r\nHw4xEHDCraMW5UXhTzAdFmiyDt+Y8u+ZJrTuSu4ZhU6GD/P+woRwpSXUwM6h\r\nks18Sbk42yztofbbFTLJ0KTaXOTgImsN/WlelefN50dE+WWFKYKtQdbLy0yi\r\nNiA7kIgkg9dWKEJeQMTZ9ybPHtnbW6QJU2+/ltCyEsUTq7vRp/nc93VhF3fL\r\nGpS45ewpYLuroe7+tjd2vTbq7kX+PNQZYSQR6YsoPHzDjYgakl3vBx9hyfay\r\ngiu6HAIptOnWPNXAQ30Ug3r7P2byfznIZbU=\r\n=jxx6\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"randy.cylonix","email":"randy.huang@ezblock.io"},"maintainers":[{"name":"randy.cylonix","email":"randy.huang@ezblock.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-webrtc_1.100.1_1679231010628_0.6524889360468953"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-19T13:03:30.525Z","1.100.1":"2023-03-19T13:03:30.803Z","modified":"2023-03-19T13:03:31.020Z"},"maintainers":[{"name":"randy.cylonix","email":"randy.huang@ezblock.io"}],"description":"WebRTC for React Native","homepage":"https://github.com/react-native-webrtc/react-native-webrtc","keywords":["react-component","react-native","ios","android","webrtc"],"repository":{"type":"git","url":"git+https://github.com/react-native-webrtc/react-native-webrtc.git"},"author":{"name":"Cylonix Authors"},"bugs":{"url":"https://github.com/react-native-webrtc/react-native-webrtc/issues"},"license":"MIT","readme":"# react-native-webrtc\n\n[![npm version](https://badge.fury.io/js/react-native-webrtc.svg)](https://badge.fury.io/js/react-native-webrtc)\n[![npm downloads](https://img.shields.io/npm/dm/react-native-webrtc.svg?maxAge=2592000)](https://img.shields.io/npm/dm/react-native-webrtc.svg?maxAge=2592000)\n\nA WebRTC module for React Native.\n- Support iOS / macOS / Android.\n- Support Video / Audio / Data Channels.\n\n> 🚨 Expo: This package is not available in the [Expo Go](https://expo.dev/client) app. Learn how you can use this package in [Custom Dev Clients](https://docs.expo.dev/development/getting-started/) via the out-of-tree [Expo Config Plugin](https://github.com/expo/config-plugins/tree/master/packages/react-native-webrtc).\n\n## Community\n\nEveryone is welcome to our [Discourse community](https://react-native-webrtc.discourse.group/) to discuss any React Native and WebRTC related topics.\n\n## WebRTC Revision\n\n* Currently used revision: [M94](https://github.com/jitsi/webrtc/releases/tag/v94.0.0)\n* Supported architectures\n  * Android: armeabi-v7a, arm64-v8a, x86, x86_64\n  * iOS: arm64, x86_64 (for bitcode support, run [this script](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/tools/downloadBitcode.sh))\n  * macOS: x86_64\n\n## Installation\n\n- [iOS](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/Documentation/iOSInstallation.md)\n- [Android](https://github.com/react-native-webrtc/react-native-webrtc/blob/master/Documentation/AndroidInstallation.md)\n\n## Usage\nNow, you can use WebRTC like in browser.\nIn your `index.ios.js`/`index.android.js`, you can require WebRTC to import RTCPeerConnection, RTCSessionDescription, etc.\n\n```javascript\nimport {\n  RTCPeerConnection,\n  RTCIceCandidate,\n  RTCSessionDescription,\n  RTCView,\n  MediaStream,\n  MediaStreamTrack,\n  mediaDevices,\n  registerGlobals\n} from 'react-native-webrtc';\n```\nAnything about using RTCPeerConnection, RTCSessionDescription and RTCIceCandidate is like browser.\nSupport most WebRTC APIs, please see the [Document](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection).\n\n```javascript\nconst configuration = {\"iceServers\": [{\"url\": \"stun:stun.l.google.com:19302\"}]};\nconst pc = new RTCPeerConnection(configuration);\n\nlet isFront = true;\nmediaDevices.enumerateDevices().then(sourceInfos => {\n  console.log(sourceInfos);\n  let videoSourceId;\n  for (let i = 0; i < sourceInfos.length; i++) {\n    const sourceInfo = sourceInfos[i];\n    if(sourceInfo.kind == \"videoinput\" && sourceInfo.facing == (isFront ? \"front\" : \"environment\")) {\n      videoSourceId = sourceInfo.deviceId;\n    }\n  }\n  mediaDevices.getUserMedia({\n    audio: true,\n    video: {\n      width: 640,\n      height: 480,\n      frameRate: 30,\n      facingMode: (isFront ? \"user\" : \"environment\"),\n      deviceId: videoSourceId\n    }\n  })\n  .then(stream => {\n    // Got stream!\n  })\n  .catch(error => {\n    // Log error\n  });\n});\n\npc.createOffer().then(desc => {\n  pc.setLocalDescription(desc).then(() => {\n    // Send pc.localDescription to peer\n  });\n});\n\npc.onicecandidate = function (event) {\n  // send event.candidate to peer\n};\n\n// also support setRemoteDescription, createAnswer, addIceCandidate, onnegotiationneeded, oniceconnectionstatechange, onsignalingstatechange, onaddstream\n\n```\n\n### RTCView\n\nHowever, render video stream should be used by React way.\n\nRendering RTCView.\n\n```javascript\n<RTCView streamURL={this.state.stream.toURL()}/>\n```\n\n| Name                           | Type             | Default                   | Description                                                                                                                                |\n| ------------------------------ | ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |\n| mirror                         | boolean          | false               | Indicates whether the video specified by \"streamURL\" should be mirrored during rendering. Commonly, applications choose to mirror theuser-facing camera.                                                                                                                       |\n| objectFit                      | string           | 'contain'           | Can be contain or cover                                                                                                | \n| streamURL                      | string           | ''                  | This is mandatory                                                                                                                      |\n| zOrder                         | number           | 0                   | Similarly to zIndex                                                                                              |\n\n\n### Custom APIs\n\n#### registerGlobals()\n\nBy calling this method the JavaScript global namespace gets \"polluted\" with the following additions:\n\n* `navigator.mediaDevices.getUserMedia()`\n* `navigator.mediaDevices.getDisplayMedia()`\n* `navigator.mediaDevices.enumerateDevices()`\n* `window.RTCPeerConnection`\n* `window.RTCIceCandidate`\n* `window.RTCSessionDescription`\n* `window.MediaStream`\n* `window.MediaStreamTrack`\n\nThis is useful to make existing WebRTC JavaScript libraries (that expect those globals to exist) work with react-native-webrtc.\n\n\n#### MediaStreamTrack.prototype._switchCamera()\n\nThis function allows to switch the front / back cameras in a video track\non the fly, without the need for adding / removing tracks or renegotiating.\n\n#### VideoTrack.enabled\n\nStarting with version 1.67, when setting a local video track's enabled state to\n`false`, the camera will be closed, but the track will remain alive. Setting\nit back to `true` will re-enable the camera.\n\n## Related projects\n\nThe [react-native-webrtc](https://github.com/react-native-webrtc) organization provides a number of packages which are useful when developing Real Time Communications applications.\n\nThe [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for react-native-web support, allowing you to use [(almost)](https://github.com/react-native-webrtc/react-native-webrtc-web-shim/tree/main#setup) the same code in react-native-web as in react-native.\n\n## Acknowledgements\n\nThanks to all [contributors](https://github.com/react-native-webrtc/react-native-webrtc/graphs/contributors) for helping with the project!\n\nSpecial thanks to [Wan Huang Yang](https://github.com/oney/) for creating the first version of this package.\n","readmeFilename":"README.md"}