├── Documentation
├── WebInstallation.md
└── ChromeOSInstallation.md
├── MediaStream.js
├── RTCView
├── resolveAssetSource.js
├── RTCViewResizeMode.js
├── __tests__
│ └── index-test.js
└── index.js
├── RTCIceCandidate.js
├── getUserMedia.js
├── MediaStreamTrack.js
├── RTCPeerConnection.js
├── RTCSessionDescription.js
├── .gitignore
├── index.js
├── .travis.yml
├── package.json
├── LICENSE
└── README.md
/Documentation/WebInstallation.md:
--------------------------------------------------------------------------------
1 | ## Web Installation
2 |
3 | TODO:
--------------------------------------------------------------------------------
/Documentation/ChromeOSInstallation.md:
--------------------------------------------------------------------------------
1 | ## ChromeOS Installation
2 |
3 | TODO:
--------------------------------------------------------------------------------
/MediaStream.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | var MediaStream = window.MediaStream || window.mozMediaStream ||
3 | window.webkitMediaStream || window.msMediaStream
4 |
5 | export default MediaStream
--------------------------------------------------------------------------------
/RTCView/resolveAssetSource.js:
--------------------------------------------------------------------------------
1 | function resolveAssetSource(source) {
2 | return ((typeof source === 'object') ? source.uri : source) || null;
3 | }
4 |
5 | module.exports = resolveAssetSource;
6 |
--------------------------------------------------------------------------------
/RTCIceCandidate.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | var RTCIceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate ||
3 | window.webkitRTCIceCandidate || window.msRTCIceCandidate
4 |
5 | export default RTCIceCandidate
--------------------------------------------------------------------------------
/getUserMedia.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var getUserMedia = (navigator.getUserMedia || navigator.mozGetUserMedia ||
4 | navigator.webkitGetUserMedia || navigator.msGetUserMedia).bind(navigator);
5 | export default getUserMedia;
6 |
7 |
--------------------------------------------------------------------------------
/MediaStreamTrack.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | 'use strict';
3 | var MediaStreamTrack = window.MediaStreamTrack || window.mozMediaStreamTrack ||
4 | window.webkitMediaStreamTrack || window.msMediaStreamTrack
5 |
6 | export default MediaStreamTrack
--------------------------------------------------------------------------------
/RTCPeerConnection.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection ||
4 | window.webkitRTCPeerConnection || window.msRTCPeerConnection
5 |
6 | export default RTCPeerConnection
7 |
8 |
--------------------------------------------------------------------------------
/RTCSessionDescription.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var RTCSessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription ||
4 | window.webkitRTCSessionDescription || window.msRTCSessionDescription
5 |
6 | export default RTCSessionDescription
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependency directory
2 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3 | node_modules
4 | ios/RCTWebRTC.xcodeproj/xcuserdata
5 | ios/RCTWebRTC.xcodeproj/project.xcworkspace
6 | .DS_Store
7 | .idea
8 | npm-debug.log
9 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import RTCPeerConnection from './RTCPeerConnection';
4 | import RTCIceCandidate from './RTCIceCandidate';
5 | import RTCSessionDescription from './RTCSessionDescription';
6 | import MediaStream from './MediaStream';
7 | import MediaStreamTrack from './MediaStreamTrack';
8 | import getUserMedia from './getUserMedia';
9 | import RTCView from './RTCView';
10 |
11 | module.exports = {
12 | RTCPeerConnection,
13 | RTCIceCandidate,
14 | RTCSessionDescription,
15 | MediaStream,
16 | MediaStreamTrack,
17 | getUserMedia,
18 | RTCView,
19 | };
20 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 6.2.2
4 | after_script:
5 | - git describe --tags --exact-match 2>/dev/null
6 | - echo $?
7 | notifications:
8 | slack: liiveteam:Aj7V8m8n5p2GGf3F4cHTiv3W
9 | branches:
10 | only:
11 | - master
12 | - develop
13 | on_success: change
14 | on_failure: always
15 | on_start: never
16 | deploy:
17 | provider: npm
18 | api_key: $NPM_KEY
19 | email: "robblovell@gmail.com"
20 | on:
21 | tags: true
22 | branch: master
23 | skip_cleanup: true
24 | clean_up: false
25 | repo: liivevideo/react-native-web-webrtc
26 |
27 |
--------------------------------------------------------------------------------
/RTCView/RTCViewResizeMode.js:
--------------------------------------------------------------------------------
1 |
2 | var keyMirror = function(obj) {
3 | var ret = {};
4 | var key;
5 | if (!(obj instanceof Object && !Array.isArray(obj))) {
6 | throw new Error('keyMirror(...): Argument must be an object.');
7 | }
8 | for (key in obj) {
9 | if (obj.hasOwnProperty(key)) {
10 | ret[key] = key;
11 | }
12 | }
13 | return ret;
14 | };
15 |
16 | const RTCViewResizeMode = keyMirror({
17 | center: null,
18 | contain: null,
19 | cover: null,
20 | none: null,
21 | repeat: null,
22 | stretch: null
23 | });
24 |
25 | module.exports = RTCViewResizeMode;
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-web-webrtc",
3 | "description": "A sister project to react-native-web and react-native-webrtc that allows webrtc to be used with react-native-web projects.",
4 | "version": "0.0.7",
5 | "repository": {
6 | "type": "git",
7 | "url": "git+https://github.com/liivevideo/react-native-web-webrtc.git"
8 | },
9 | "scripts": {
10 | "test": "echo 'no tests'"
11 | },
12 | "nativePackage": false,
13 | "author": {
14 | "name": "Robb",
15 | "email": "robblovell@gmail.com"
16 | },
17 | "homepage": "https://github.com/liivevideo/react-native-web-webrtc",
18 | "keywords": [
19 | "react-component",
20 | "react-native",
21 | "react-native-web",
22 | "chromeOS",
23 | "browsers",
24 | "web",
25 | "webrtc"
26 | ],
27 | "dependencies": {
28 | "react-native-web": "https://github.com/liivevideo/react-native-web.git"
29 | },
30 | "bugs": {
31 | "url": "https://github.com/liivevideo/react-native-web-webrtc/issues"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 LiiveVideo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-web-webrtc
2 |
3 | A WebRTC module for React Native Web.
4 |
5 | [](https://travis-ci.org/liivevideo/react-native-web-webrtc)
6 |
7 | ## Support
8 | - Supports browsers and chromeOS.
9 | - Support video and audio communication.
10 | - Supports data channels.
11 | - You can use it to build a client side application using react-native-web that can use WebRTC.
12 |
13 | ## Installation
14 |
15 | ### react-native-web-webrtc:
16 |
17 | - [Web](https://github.com/liivevideo/react-native-web-webrtc/blob/master/Documentation/WebInstallation.md)
18 | - [ChromeOS](https://github.com/liivevideo/react-native-web-webrtc/blob/master/Documentation/ChromeOSInstallation.md)
19 |
20 | ## Usage
21 | Now, you can use WebRTC using react-native in a browser or chromeOS.
22 |
23 | In your `index.web.js`/`index.chromeos.js` file:
24 |
25 | ```javascript
26 | var WebRTC = require('react-native-web-webrtc');
27 | var {
28 | RTCPeerConnection,
29 | RTCMediaStream,
30 | RTCIceCandidate,
31 | RTCSessionDescription,
32 | MediaStreamTrack,
33 | getUserMedia,
34 | RTCView
35 | } = WebRTC;
36 | ```
37 |
38 | ## TODO:
39 |
40 | * Example project
41 | * Documentation of implementation
42 | * Clean up RTCView: unnecessary code.
43 |
44 | ## Sister Projects:
45 |
46 | This is a sister project to: [react-native-webrtc](https://github.com/oney/react-native-webrtc) and [react-native-web](git://github.com/necolas/react-native-web.git)
47 |
--------------------------------------------------------------------------------
/RTCView/__tests__/index-test.js:
--------------------------------------------------------------------------------
1 | /* eslint-env mocha */
2 |
3 | import assert from 'assert';
4 | import RTCView from '../';
5 | import React from 'react';
6 | import StyleSheet from '../../../apis/StyleSheet';
7 | import { mount, shallow } from 'enzyme';
8 |
9 | suite('components/RTCView', () => {
10 | test('sets correct accessibility role"', () => {
11 | const rtcVideoView = shallow(