Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "webrtc", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"keywords": ["webrtc", "browser"], | ||
@@ -15,4 +15,4 @@ "repository": { | ||
"rtcpeerconnection": "0.2.0", | ||
"getusermedia": "0.1.0", | ||
"getscreenmedia": "0.1.0", | ||
"getusermedia": "0.2.0", | ||
"getscreenmedia": "0.2.0", | ||
"hark": "0.1.1" | ||
@@ -19,0 +19,0 @@ }, |
@@ -24,3 +24,6 @@ (function(e){if("function"==typeof bootstrap)bootstrap("webrtc",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeWebRTC=e}else"undefined"!=typeof window?window.WebRTC=e():global.WebRTC=e()})(function(){var define,ses,bootstrap,module,exports; | ||
peerConnectionContraints: { | ||
optional: [{"DtlsSrtpKeyAgreement": true}] | ||
optional: [ | ||
{DtlsSrtpKeyAgreement: true}, | ||
{RtpDataChannels: true} | ||
] | ||
}, | ||
@@ -82,5 +85,3 @@ media: { | ||
getUserMedia(constraints, function (err, stream) { | ||
if (err) { | ||
throw new Error('Failed to get access to local media.'); | ||
} else { | ||
if (!err) { | ||
if (constraints.audio) { | ||
@@ -95,4 +96,4 @@ self.setupAudioMonitor(stream); | ||
self.emit('localStream', stream); | ||
if (cb) cb(stream); | ||
} | ||
if (cb) cb(err, stream); | ||
}); | ||
@@ -327,35 +328,5 @@ }; | ||
module.exports = WebRTC; | ||
},{"getusermedia":2,"hark":6,"rtcpeerconnection":4,"webrtcsupport":3,"wildemitter":5}],2:[function(require,module,exports){ | ||
// getUserMedia helper by @HenrikJoreteg | ||
var func = (navigator.getUserMedia || | ||
navigator.webkitGetUserMedia || | ||
navigator.mozGetUserMedia || | ||
navigator.msGetUserMedia); | ||
module.exports = function (contstraints, cb) { | ||
var options; | ||
var haveOpts = arguments.length === 2; | ||
var defaultOpts = {video: true, audio: true}; | ||
// make contstraints optional | ||
if (!haveOpts) { | ||
cb = contstraints; | ||
contstraints = defaultOpts; | ||
} | ||
// treat lack of browser support like an error | ||
if (!func) return cb(new Error('notSupported')); | ||
func.call(navigator, contstraints, function (stream) { | ||
cb(null, stream); | ||
}, function (err) { | ||
cb(err); | ||
}); | ||
}; | ||
},{}],3:[function(require,module,exports){ | ||
},{"getusermedia":3,"hark":6,"rtcpeerconnection":4,"webrtcsupport":2,"wildemitter":5}],2:[function(require,module,exports){ | ||
// created by @HenrikJoreteg | ||
@@ -387,2 +358,66 @@ var PC = window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.RTCPeerConnection; | ||
},{}],3:[function(require,module,exports){ | ||
// getUserMedia helper by @HenrikJoreteg | ||
var func = (navigator.getUserMedia || | ||
navigator.webkitGetUserMedia || | ||
navigator.mozGetUserMedia || | ||
navigator.msGetUserMedia); | ||
module.exports = function (constraints, cb) { | ||
var options; | ||
var haveOpts = arguments.length === 2; | ||
var defaultOpts = {video: true, audio: true}; | ||
var error; | ||
var denied = 'PERMISSION_DENIED'; | ||
var notSatified = 'CONSTRAINT_NOT_SATISFIED'; | ||
// make constraints optional | ||
if (!haveOpts) { | ||
cb = constraints; | ||
constraints = defaultOpts; | ||
} | ||
// treat lack of browser support like an error | ||
if (!func) { | ||
// throw proper error per spec | ||
error = new Error('NavigatorUserMediaError'); | ||
error.name = 'NOT_SUPPORTED_ERROR'; | ||
return cb(error); | ||
} | ||
func.call(navigator, constraints, function (stream) { | ||
cb(null, stream); | ||
}, function (err) { | ||
var error; | ||
// coerce into an error object since FF gives us a string | ||
// there are only two valid names according to the spec | ||
// we coerce all non-denied to "constraint not satisfied". | ||
if (typeof err === 'string') { | ||
error = new Error('NavigatorUserMediaError'); | ||
if (err === denied) { | ||
error.name = denied; | ||
} else { | ||
error.name = notSatified; | ||
} | ||
} else { | ||
// if we get an error object make sure '.name' property is set | ||
// according to spec: http://dev.w3.org/2011/webrtc/editor/getusermedia.html#navigatorusermediaerror-and-navigatorusermediaerrorcallback | ||
error = err; | ||
if (!error.name) { | ||
// this is likely chrome which | ||
// sets a property called "ERROR_DENIED" on the error object | ||
// if so we make sure to set a name | ||
if (error[denied]) { | ||
err.name = denied; | ||
} else { | ||
err.name = notSatified; | ||
} | ||
} | ||
} | ||
cb(error); | ||
}); | ||
}; | ||
},{}],5:[function(require,module,exports){ | ||
@@ -663,3 +698,3 @@ /* | ||
},{"webrtcsupport":3,"wildemitter":5}],6:[function(require,module,exports){ | ||
},{"webrtcsupport":2,"wildemitter":5}],6:[function(require,module,exports){ | ||
var WildEmitter = require('wildemitter'); | ||
@@ -666,0 +701,0 @@ |
@@ -22,3 +22,6 @@ var webrtc = require('webrtcsupport'); | ||
peerConnectionContraints: { | ||
optional: [{"DtlsSrtpKeyAgreement": true}] | ||
optional: [ | ||
{DtlsSrtpKeyAgreement: true}, | ||
{RtpDataChannels: true} | ||
] | ||
}, | ||
@@ -80,5 +83,3 @@ media: { | ||
getUserMedia(constraints, function (err, stream) { | ||
if (err) { | ||
throw new Error('Failed to get access to local media.'); | ||
} else { | ||
if (!err) { | ||
if (constraints.audio) { | ||
@@ -93,4 +94,4 @@ self.setupAudioMonitor(stream); | ||
self.emit('localStream', stream); | ||
if (cb) cb(stream); | ||
} | ||
if (cb) cb(err, stream); | ||
}); | ||
@@ -325,3 +326,2 @@ }; | ||
module.exports = WebRTC; |
33687
942
+ Addedgetscreenmedia@0.2.0(transitive)
+ Addedgetusermedia@0.2.0(transitive)
- Removedgetscreenmedia@0.1.0(transitive)
- Removedgetusermedia@0.1.0(transitive)
Updatedgetscreenmedia@0.2.0
Updatedgetusermedia@0.2.0