Permalink
Browse files

init

  • Loading branch information...
contra committed Dec 3, 2015
0 parents commit fdd2f73b9fa498a722aff1e82573b7144561ea3f
Showing with 400 additions and 0 deletions.
  1. +10 −0 .editorconfig
  2. +23 −0 .gitignore
  3. +19 −0 .jshintrc
  4. +23 −0 .npmignore
  5. +9 −0 .travis.yml
  6. +20 −0 LICENSE
  7. +76 −0 README.md
  8. +3 −0 index.js
  9. +31 −0 lib/getUserMedia/browser.js
  10. +28 −0 lib/getUserMedia/ios.js
  11. +15 −0 lib/getUserMedia/node.js
  12. +41 −0 lib/index.js
  13. +10 −0 lib/rtc/chrome.js
  14. +10 −0 lib/rtc/edge.js
  15. +10 −0 lib/rtc/firefox.js
  16. +13 −0 lib/rtc/ios.js
  17. +10 −0 lib/rtc/node.js
  18. +38 −0 package.json
  19. +11 −0 test/index.js
@@ -0,0 +1,10 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
@@ -0,0 +1,23 @@
+.DS_Store
+build
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules
+*.sublime*
+*.node
+coverage
+*.orig
+.idea
+sandbox
@@ -0,0 +1,19 @@
+{
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "freeze": true,
+ "indent": 2,
+ "newcap": false,
+ "quotmark": "single",
+ "maxdepth": 3,
+ "maxstatements": 50,
+ "maxlen": 80,
+ "eqnull": true,
+ "funcscope": true,
+ "strict": true,
+ "undef": true,
+ "unused": true,
+ "node": true,
+ "mocha": true
+}
@@ -0,0 +1,23 @@
+.DS_Store
+build
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules
+*.sublime*
+*.node
+coverage
+*.orig
+.idea
+sandbox
@@ -0,0 +1,9 @@
+sudo: false
+language: node_js
+node_js:
+ - 'iojs'
+ - '0.12'
+ - '0.10'
+ - '4.0.0'
+after_script:
+ - npm run coveralls
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2015 Contra <contra@maricopa.edu>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,76 @@
+# rtc-everywhere [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Support us][gittip-image]][gittip-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]
+
+
+## Information
+
+<table>
+<tr>
+<td>Package</td>
+<td>rtc-everywhere</td>
+</tr>
+<tr>
+<td>Description</td>
+<td>Cross-everything WebRTC Adapter/Polyfill</td>
+</tr>
+<tr>
+<td>Node Version</td>
+<td>>= 0.10</td>
+</tr>
+</table>
+
+## Usage
+
+## Install
+
+```
+npm install rtc-everywhere --save
+```
+## Example
+
+```js
+EXAMPLEHERE
+```
+
+## LICENSE
+
+(MIT License)
+
+Copyright (c) 2015 Contra <contra@maricopa.edu>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+[gittip-url]: https://www.gittip.com/contra/
+[gittip-image]: http://img.shields.io/gittip/contra.svg
+
+[downloads-image]: http://img.shields.io/npm/dm/rtc-everywhere.svg
+[npm-url]: https://npmjs.org/package/rtc-everywhere
+[npm-image]: http://img.shields.io/npm/v/rtc-everywhere.svg
+
+[travis-url]: https://travis-ci.org/contra/rtc-everywhere
+[travis-image]: https://travis-ci.org/contra/rtc-everywhere.png?branch=master
+
+[coveralls-url]: https://coveralls.io/r/contra/rtc-everywhere
+[coveralls-image]: https://coveralls.io/repos/contra/rtc-everywhere/badge.png
+
+[depstat-url]: https://david-dm.org/contra/rtc-everywhere
+[depstat-image]: https://david-dm.org/contra/rtc-everywhere.png
+
+[david-url]: https://david-dm.org/contra/rtc-everywhere
+[david-image]: https://david-dm.org/contra/rtc-everywhere.png?theme=shields.io
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = {};
@@ -0,0 +1,31 @@
+'use strict';
+
+module.exports = function() {
+ if (typeof navigator === 'undefined') return;
+ var getUserMedia = navigator.getUserMedia
+ || navigator.webkitGetUserMedia
+ || navigator.mozGetUserMedia
+ || navigator.msGetUserMedia;
+ if (typeof getUserMedia === 'undefined') return;
+
+ return function(constraints, cb) {
+ // make constraints optional
+ if (arguments.length !== 2) {
+ cb = constraints;
+ constraints = {
+ video: true,
+ audio: true
+ };
+ }
+
+ function success(stream) {
+ cb(null, stream);
+ }
+
+ function error(err) {
+ cb(err);
+ }
+
+ getUserMedia.call(navigator, constraints, success, error);
+ };
+};
@@ -0,0 +1,28 @@
+'use strict';
+
+module.exports = function() {
+ return function(constraints, cb) {
+ if (typeof cordova === 'undefined') return;
+ if (typeof cordova.plugins === 'undefined') return;
+ if (typeof cordova.plugins.iosrtc === 'undefined') return;
+
+ // make constraints optional
+ if (arguments.length !== 2) {
+ cb = constraints;
+ constraints = {
+ video: true,
+ audio: true
+ };
+ }
+
+ function success(stream) {
+ cb(null, stream);
+ }
+
+ function error(err) {
+ cb(err);
+ }
+
+ cordova.plugins.iosrtc.getUserMedia(constraints, success, error);
+ };
+};
@@ -0,0 +1,15 @@
+'use strict';
+
+module.exports = function() {
+ return function(constraints, cb) {
+
+ // make constraints optional
+ if (arguments.length !== 2) {
+ cb = constraints;
+ }
+
+ var err = new Error('MediaStreamError');
+ err.name = 'NotSupportedError';
+ return cb(err);
+ };
+};
@@ -0,0 +1,41 @@
+'use strict';
+
+var browser = require('detect-browser');
+
+var getUserMedia, rtc;
+switch (browser.name) {
+ case 'node':
+ getUserMedia = require('./getUserMedia/node');
+ rtc = require('./rtc/node');
+ break;
+ case 'ios':
+ getUserMedia = require('./getUserMedia/ios');
+ rtc = require('./rtc/ios');
+ break;
+ case 'chrome':
+ getUserMedia = require('./getUserMedia/browser');
+ rtc = require('./rtc/chrome');
+ break;
+ case 'firefox':
+ getUserMedia = require('./getUserMedia/browser');
+ rtc = require('./rtc/firefox');
+ break;
+ case 'edge':
+ getUserMedia = require('./getUserMedia/browser');
+ rtc = require('./rtc/edge');
+ break;
+ default:
+ getUserMedia = require('./getUserMedia/browser');
+ rtc = require('./rtc/unsupported');
+ break;
+}
+
+module.exports = function() {
+ var ctors = rtc();
+ return {
+ getUserMedia: getUserMedia(),
+ RTCPeerConnection: ctors.RTCPeerConnection,
+ RTCSessionDescription: ctors.RTCSessionDescription,
+ RTCIceCandidate: ctors.RTCIceCandidate
+ };
+};
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = function() {
+ if (typeof window === 'undefined') return;
+ return {
+ RTCPeerConnection: window.RTCPeerConnection || window.webkitRTCPeerConnection,
+ RTCSessionDescription: window.RTCSessionDescription || window.webkitRTCSessionDescription,
+ RTCIceCandidate: window.RTCIceCandidate || window.webkitRTCIceCandidate
+ };
+};
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = function() {
+ var ortc = require('ortc-adapter');
+ return {
+ RTCPeerConnection: ortc.RTCPeerConnection,
+ RTCSessionDescription: ortc.RTCSessionDescription,
+ RTCIceCandidate: ortc.RTCIceCandidate
+ };
+};
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = function() {
+ if (typeof window === 'undefined') return;
+ return {
+ RTCPeerConnection: window.RTCPeerConnection || window.mozRTCPeerConnection,
+ RTCSessionDescription: window.RTCSessionDescription || window.mozRTCSessionDescription,
+ RTCIceCandidate: window.RTCIceCandidate || window.mozRTCIceCandidate
+ };
+};
@@ -0,0 +1,13 @@
+'use strict';
+
+module.exports = function() {
+ if (typeof cordova === 'undefined') return;
+ if (typeof cordova.plugins === 'undefined') return;
+ if (typeof cordova.plugins.iosrtc === 'undefined') return;
+
+ return {
+ RTCPeerConnection: cordova.plugins.iosrtc.RTCPeerConnection,
+ RTCSessionDescription: cordova.plugins.iosrtc.RTCSessionDescription,
+ RTCIceCandidate: cordova.plugins.iosrtc.RTCIceCandidate
+ };
+};
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = function() {
+ var wrtc = require('wrtc');
+ return {
+ RTCPeerConnection: wrtc.RTCPeerConnection,
+ RTCSessionDescription: wrtc.RTCSessionDescription,
+ RTCIceCandidate: wrtc.RTCIceCandidate
+ };
+};
Oops, something went wrong.

0 comments on commit fdd2f73

Please sign in to comment.