├── bower.json
├── .gitignore
├── package.json
├── promiseUserMedia.js
├── MIT-LICENSE.txt
└── README.md
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "promise-user-media",
3 | "version" : "1.0.0",
4 | "description" : "Promisified access to getUserMedia & vendor prefixes.",
5 | "main": "./promiseUserMedia.js",
6 | "dependencies": {},
7 | "homepage" : "http://getuser.media",
8 | "keywords": [
9 | "webrc",
10 | "getusermedia",
11 | "promise"
12 | ],
13 | "author" : {
14 | "name" : "Jan Lelis",
15 | "email" : "mail@janlelis.de",
16 | "url" : "http://janlelis.com"
17 | },
18 | "license": "MIT"
19 | }
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17 | .grunt
18 |
19 | # Compiled binary addons (http://nodejs.org/api/addons.html)
20 | build/Release
21 |
22 | # Dependency directory
23 | # Commenting this out is preferred by some people, see
24 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
25 | node_modules
26 |
27 | # Users Environment Variables
28 | .lock-wscript
29 |
30 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "promise-user-media",
3 | "version": "1.0.0",
4 | "description": "Promisified access to getUserMedia & vendor prefixes.",
5 | "main": "promiseUserMedia.js",
6 | "dependencies": {},
7 | "devDependencies": {
8 | "browserify": "^5.11.2"
9 | },
10 | "scripts": {
11 | "build": "browserify -s promiseUserMedia -e ./ > promiseUserMedia.bundle.js"
12 | },
13 | "repository": {
14 | "type": "git",
15 | "url": "git://github.com/janlelis/promiseUserMedia.js.git"
16 | },
17 | "homepage": "http://getuser.media",
18 | "keywords": [
19 | "webrtc",
20 | "getusermedia",
21 | "promise"
22 | ],
23 | "author": {
24 | "name": "Jan Lelis",
25 | "email": "mail@janlelis.de",
26 | "url": "http://janlelis.com"
27 | },
28 | "license": "MIT"
29 | }
30 |
--------------------------------------------------------------------------------
/promiseUserMedia.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | (function(global, code){ if(typeof exports === 'object'){ module.exports = code(); }
4 | else{ global.promiseUserMedia = code(); }}(this, function(){
5 |
6 | ////
7 | // promiseUserMedia.js
8 | // Promisified access to getUserMedia & vendor prefixes
9 |
10 | var promiseUserMedia = function promiseUserMedia(constraints){
11 | return new Promise(function promiseUserMediaPromise(resolve, reject){
12 | if(!promiseUserMedia.isAvailable){
13 | error = new Error('getUserMedia is not supported');
14 | error.name = "NotSupportedError";
15 | reject(error);
16 | } else {
17 | promiseUserMedia.getUserMedia.call(navigator, constraints, resolve, reject);
18 | }
19 | });
20 | }
21 |
22 | promiseUserMedia.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||
23 | navigator.mozGetUserMedia || navigator.msGetUserMedia;
24 |
25 | promiseUserMedia.isAvailable = !! promiseUserMedia.getUserMedia;
26 |
27 | return promiseUserMedia;
28 | }));
29 |
--------------------------------------------------------------------------------
/MIT-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Jan Lelis
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # promiseUserMedia.js
2 |
3 | Promisified access to getUserMedia & vendor prefixes.
4 |
5 | ### Install
6 |
7 | Include the promiseUserMedia.js file and you will get a `promiseUserMedia` global. You can
8 | fetch the library from bower (**promise-user-media**) or use npm (**promise-user-media**) & browserify.
9 |
10 | ### Usage
11 |
12 | ```html
13 |
14 |
24 | ```
25 |
26 | ### More getUserMedia wrappers
27 |
28 | - [HenrikJoreteg/getUserMedia](https://github.com/HenrikJoreteg/getUserMedia)
29 | - [juliangruber/get-user-media](https://github.com/juliangruber/get-user-media)
30 | - [addyosmani/getUserMedia.js](https://github.com/addyosmani/getUserMedia.js)
31 |
32 | ### License
33 |
34 | MIT. Copyright (c) 2014 [Jan Lelis.](https://twitter.com/janlelis)
35 |
36 |
--------------------------------------------------------------------------------