├── .prettierignore ├── .eslintignore ├── .lintstagedrc.js ├── .prettierrc.js ├── src ├── RTCView.js ├── react-native-webrtc-web-shim.js ├── RTCView.web.js └── react-native-webrtc-web-shim.web.js ├── .gitignore ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .eslintrc.js ├── index.js ├── LICENSE ├── package.json └── README.md /.prettierignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | test/kite 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # ignore kite files 2 | test/kite/ 3 | 4 | demo 5 | -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '{,.,**/}*.{md,json,js,ts,tsx}': ['prettier --write'], 3 | }; 4 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: true, 3 | singleQuote: true, 4 | trailingComma: 'all', 5 | }; 6 | -------------------------------------------------------------------------------- /src/RTCView.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { RTCView as OriginalRTCView } from 'react-native-webrtc'; 3 | 4 | export default function RTCView({ stream, ...props }) { 5 | return ; 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | # ignore files output from npm pack 4 | *shim*.tgz 5 | 6 | # ignore IDE files 7 | .idea 8 | *.iml 9 | 10 | # ignore kite files 11 | test/kite/logs 12 | test/kite/allure-report 13 | test/kite/results 14 | test/kite/target 15 | test/kite/kite-allure-reports 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | **Describe the bug** 7 | 8 | 9 | 10 | **Instructions To reproduce** 11 | 12 | 13 | 14 | **Versions (please complete the following information):** 15 | 16 | - React Native Version: 17 | - React Native Web Version: 18 | - React Native WebRTC Version: 19 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | extends: [ 7 | 'plugin:react/recommended', 8 | 'airbnb-base', 9 | 'plugin:prettier/recommended', 10 | ], 11 | parserOptions: { 12 | ecmaFeatures: { 13 | jsx: true, 14 | }, 15 | ecmaVersion: 12, 16 | sourceType: 'module', 17 | }, 18 | plugins: ['react'], 19 | rules: { 20 | 'prettier/prettier': 'error', 21 | 'react/prop-types': 'off', 22 | 'no-underscore-dangle': 'off', 23 | 'no-console': 'off', 24 | }, 25 | settings: { 26 | react: { 27 | version: 'detect', 28 | }, 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { 2 | RTCPeerConnection, 3 | RTCIceCandidate, 4 | RTCSessionDescription, 5 | RTCRtpTransceiver, 6 | RTCRtpReceiver, 7 | RTCRtpSender, 8 | RTCErrorEvent, 9 | MediaStream, 10 | MediaStreamTrack, 11 | mediaDevices, 12 | permissions, 13 | registerGlobals, 14 | RTCView, 15 | } from './src/react-native-webrtc-web-shim'; 16 | 17 | export { 18 | RTCPeerConnection, 19 | RTCIceCandidate, 20 | RTCSessionDescription, 21 | RTCRtpTransceiver, 22 | RTCRtpReceiver, 23 | RTCRtpSender, 24 | RTCErrorEvent, 25 | MediaStream, 26 | MediaStreamTrack, 27 | mediaDevices, 28 | permissions, 29 | registerGlobals, 30 | RTCView, 31 | }; 32 | -------------------------------------------------------------------------------- /src/react-native-webrtc-web-shim.js: -------------------------------------------------------------------------------- 1 | import { 2 | RTCPeerConnection, 3 | RTCIceCandidate, 4 | RTCSessionDescription, 5 | RTCRtpTransceiver, 6 | RTCRtpReceiver, 7 | RTCRtpSender, 8 | RTCErrorEvent, 9 | MediaStream, 10 | MediaStreamTrack, 11 | mediaDevices, 12 | permissions, 13 | registerGlobals, 14 | } from 'react-native-webrtc'; 15 | 16 | import RTCView from './RTCView'; 17 | 18 | export { 19 | RTCPeerConnection, 20 | RTCIceCandidate, 21 | RTCSessionDescription, 22 | RTCRtpTransceiver, 23 | RTCRtpReceiver, 24 | RTCRtpSender, 25 | RTCErrorEvent, 26 | MediaStream, 27 | MediaStreamTrack, 28 | mediaDevices, 29 | permissions, 30 | registerGlobals, 31 | RTCView, 32 | }; 33 | -------------------------------------------------------------------------------- /src/RTCView.web.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | /* eslint-disable-next-line camelcase */ 3 | import { unstable_createElement } from 'react-native-web'; 4 | 5 | const Video = React.forwardRef((props, ref) => 6 | unstable_createElement('video', { ...props, ref }), 7 | ); 8 | Video.displayName = 'Video'; 9 | 10 | export default function RTCView({ stream, ...props }) { 11 | const videoRef = React.createRef(); 12 | React.useEffect(() => { 13 | if (stream && videoRef.current) { 14 | videoRef.current.srcObject = stream; 15 | } 16 | }, [stream, videoRef]); 17 | 18 | return ( 19 |