webrtc-adapter
Advanced tools
Comparing version 1.2.2 to 1.3.0
'use strict'; | ||
/* For jshint: */ | ||
/* globals module, require */ | ||
module.exports = function(grunt) { | ||
@@ -17,4 +14,2 @@ grunt.initConfig({ | ||
// The tests require this. | ||
// TODO: Replace adapter with <%= pkg.name %>' which uses the name | ||
// from package.json once we have a better NPM name. | ||
standalone: 'adapter' | ||
@@ -42,5 +37,2 @@ } | ||
// Exposes the shim in a global object to the browser. | ||
// The tests require this. | ||
// TODO: Replace adapter with <%= pkg.name %>' which uses the name | ||
// from package.json once we have a better NPM name. | ||
standalone: 'adapter' | ||
@@ -70,7 +62,4 @@ } | ||
// Exposes shim methods in a global object to the browser. | ||
// The tests require this. | ||
// TODO: Replace adapter with <%= pkg.name %>' which uses the name | ||
// from package.json once we have a better NPM name. | ||
standalone: 'adapter', | ||
transform: 'babelify' | ||
transform: [['babelify', {'presets': ['es2015']}]] | ||
} | ||
@@ -86,3 +75,3 @@ } | ||
browserifyOptions: { | ||
transform: 'babelify' | ||
transform: [['babelify', {'presets': ['es2015']}]] | ||
} | ||
@@ -103,7 +92,4 @@ } | ||
// Exposes the shim in a global object to the browser. | ||
// The tests require this. | ||
// TODO: Replace adapter with <%= pkg.name %>' which uses the name | ||
// from package.json once we have a better NPM name. | ||
standalone: 'adapter', | ||
transform: 'babelify' | ||
transform: [['babelify', {'presets': ['es2015']}]] | ||
} | ||
@@ -123,3 +109,3 @@ } | ||
browserifyOptions: { | ||
transform: 'babelify' | ||
transform: [['babelify', {'presets': ['es2015']}]] | ||
} | ||
@@ -126,0 +112,0 @@ } |
@@ -26,7 +26,7 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Comment out the line below if you want logging to occur, including logging | ||
// Uncomment the line below if you want logging to occur, including logging | ||
// for the switch statement below. Can also be turned on in the browser via | ||
// adapter.disableLog(false), but then logging from the switch statement below | ||
// will not appear. | ||
require('./utils').disableLog(true); | ||
// require('./utils').disableLog(false); | ||
@@ -324,2 +324,8 @@ // Browser shims. | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function () { | ||
return arguments[0] === null ? Promise.resolve() : nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim implicit creation of RTCSessionDescription/RTCIceCandidate | ||
@@ -674,2 +680,8 @@ ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) { | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function () { | ||
return arguments[0] === null ? Promise.resolve() : nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim getStats with maplike support | ||
@@ -835,3 +847,3 @@ var makeMapStats = function makeMapStats(stats) { | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the user ' + 'agent or the platform in the current context.' | ||
'The operation is insecure.': 'The request is not allowed by the ' + 'user agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
@@ -900,3 +912,3 @@ constraint: e.constraint, | ||
return navigator.mozGetUserMedia(constraints, onSuccess, function (e) { | ||
return onError(shimError_(e)); | ||
onError(shimError_(e)); | ||
}); | ||
@@ -1000,3 +1012,3 @@ }; | ||
var logDisabled_ = false; | ||
var logDisabled_ = true; | ||
@@ -1003,0 +1015,0 @@ // Utility methods. |
@@ -26,7 +26,7 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Comment out the line below if you want logging to occur, including logging | ||
// Uncomment the line below if you want logging to occur, including logging | ||
// for the switch statement below. Can also be turned on in the browser via | ||
// adapter.disableLog(false), but then logging from the switch statement below | ||
// will not appear. | ||
require('./utils').disableLog(true); | ||
// require('./utils').disableLog(false); | ||
@@ -324,2 +324,8 @@ // Browser shims. | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function () { | ||
return arguments[0] === null ? Promise.resolve() : nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim implicit creation of RTCSessionDescription/RTCIceCandidate | ||
@@ -674,2 +680,8 @@ ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) { | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function () { | ||
return arguments[0] === null ? Promise.resolve() : nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim getStats with maplike support | ||
@@ -835,3 +847,3 @@ var makeMapStats = function makeMapStats(stats) { | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the user ' + 'agent or the platform in the current context.' | ||
'The operation is insecure.': 'The request is not allowed by the ' + 'user agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
@@ -900,3 +912,3 @@ constraint: e.constraint, | ||
return navigator.mozGetUserMedia(constraints, onSuccess, function (e) { | ||
return onError(shimError_(e)); | ||
onError(shimError_(e)); | ||
}); | ||
@@ -1000,3 +1012,3 @@ }; | ||
var logDisabled_ = false; | ||
var logDisabled_ = true; | ||
@@ -1003,0 +1015,0 @@ // Utility methods. |
@@ -25,7 +25,7 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Comment out the line below if you want logging to occur, including logging | ||
// Uncomment the line below if you want logging to occur, including logging | ||
// for the switch statement below. Can also be turned on in the browser via | ||
// adapter.disableLog(false), but then logging from the switch statement below | ||
// will not appear. | ||
require('./utils').disableLog(true); | ||
// require('./utils').disableLog(false); | ||
@@ -329,2 +329,10 @@ // Browser shims. | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim implicit creation of RTCSessionDescription/RTCIceCandidate | ||
@@ -688,2 +696,10 @@ ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim getStats with maplike support | ||
@@ -850,18 +866,19 @@ var makeMapStats = function(stats) { | ||
module.exports = function() { | ||
var shimError_ = e => ({ | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the user ' + | ||
'agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}); | ||
var shimError_ = function(e) { | ||
return { | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the ' + | ||
'user agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}; | ||
}; | ||
// getUserMedia constraints shim. | ||
@@ -923,4 +940,5 @@ var getUserMedia_ = function(constraints, onSuccess, onError) { | ||
} | ||
return navigator.mozGetUserMedia(constraints, onSuccess, | ||
e => onError(shimError_(e))); | ||
return navigator.mozGetUserMedia(constraints, onSuccess, function(e) { | ||
onError(shimError_(e)); | ||
}); | ||
}; | ||
@@ -971,4 +989,7 @@ | ||
bind(navigator.mediaDevices); | ||
navigator.mediaDevices.getUserMedia = c => | ||
origGetUserMedia(c).catch(e => Promise.reject(shimError_(e))); | ||
navigator.mediaDevices.getUserMedia = function(c) { | ||
return origGetUserMedia(c).catch(function(e) { | ||
return Promise.reject(shimError_(e)); | ||
}); | ||
}; | ||
} | ||
@@ -1024,3 +1045,3 @@ }; | ||
var logDisabled_ = false; | ||
var logDisabled_ = true; | ||
@@ -1027,0 +1048,0 @@ // Utility methods. |
@@ -25,7 +25,7 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Comment out the line below if you want logging to occur, including logging | ||
// Uncomment the line below if you want logging to occur, including logging | ||
// for the switch statement below. Can also be turned on in the browser via | ||
// adapter.disableLog(false), but then logging from the switch statement below | ||
// will not appear. | ||
require('./utils').disableLog(true); | ||
// require('./utils').disableLog(false); | ||
@@ -329,2 +329,10 @@ // Browser shims. | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim implicit creation of RTCSessionDescription/RTCIceCandidate | ||
@@ -688,2 +696,10 @@ ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim getStats with maplike support | ||
@@ -850,18 +866,19 @@ var makeMapStats = function(stats) { | ||
module.exports = function() { | ||
var shimError_ = e => ({ | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the user ' + | ||
'agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}); | ||
var shimError_ = function(e) { | ||
return { | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the ' + | ||
'user agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}; | ||
}; | ||
// getUserMedia constraints shim. | ||
@@ -923,4 +940,5 @@ var getUserMedia_ = function(constraints, onSuccess, onError) { | ||
} | ||
return navigator.mozGetUserMedia(constraints, onSuccess, | ||
e => onError(shimError_(e))); | ||
return navigator.mozGetUserMedia(constraints, onSuccess, function(e) { | ||
onError(shimError_(e)); | ||
}); | ||
}; | ||
@@ -971,4 +989,7 @@ | ||
bind(navigator.mediaDevices); | ||
navigator.mediaDevices.getUserMedia = c => | ||
origGetUserMedia(c).catch(e => Promise.reject(shimError_(e))); | ||
navigator.mediaDevices.getUserMedia = function(c) { | ||
return origGetUserMedia(c).catch(function(e) { | ||
return Promise.reject(shimError_(e)); | ||
}); | ||
}; | ||
} | ||
@@ -1024,3 +1045,3 @@ }; | ||
var logDisabled_ = false; | ||
var logDisabled_ = true; | ||
@@ -1027,0 +1048,0 @@ // Utility methods. |
{ | ||
"name": "webrtc-adapter", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -11,7 +11,2 @@ "license": "BSD-3-Clause", | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"authors": [ | ||
@@ -23,9 +18,17 @@ "The WebRTC project authors (https://www.webrtc.org/)" | ||
"version": "grunt build", | ||
"postversion": "git push --force --set-upstream origin bumpVersion --follow-tags && export GITTAG=\"echo $(git describe --abbrev=0 --tags | sed 's/^v//')\" && git checkout gh-pages && git pull && cp out/adapter.js . && cp adapter.js adapter-`$GITTAG`.js && rm adapter-latest.js && ln -s adapter-`$GITTAG`.js adapter-latest.js && mkdir adapter-`$GITTAG`-variants && cp out/adapter_*.js adapter-`$GITTAG`-variants/ && git add adapter.js adapter-latest.js adapter-`$GITTAG`.js adapter-`$GITTAG`-variants && git commit -m `$GITTAG` && git push --set-upstream origin gh-pages && git checkout master", | ||
"postversion": "git push --force --set-upstream origin bumpVersion --follow-tags && export GITTAG=\"echo $(git describe --abbrev=0 --tags | sed 's/^v//')\" && git checkout gh-pages && git pull && cp out/adapter.js adapter.js && cp adapter.js adapter-`$GITTAG`.js && rm adapter-latest.js && ln -s adapter-`$GITTAG`.js adapter-latest.js && mkdir -p adapter-`$GITTAG`-variants && cp out/adapter.js adapter-`$GITTAG`-variants/ && cp out/adapter_*.js adapter-`$GITTAG`-variants/ && git add adapter.js adapter-latest.js adapter-`$GITTAG`.js adapter-`$GITTAG`-variants && git commit -m `$GITTAG` && git push --set-upstream origin gh-pages && git checkout master", | ||
"prepublish": "grunt build", | ||
"test": "grunt && node test/run-tests.js" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"dependencies": { | ||
"sdp": "^1.0.0" | ||
}, | ||
"engines": { | ||
"npm": "~3.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -32,0 +35,0 @@ "babel-preset-es2015": "^6.6.0", |
@@ -22,7 +22,7 @@ /* | ||
// Comment out the line below if you want logging to occur, including logging | ||
// Uncomment the line below if you want logging to occur, including logging | ||
// for the switch statement below. Can also be turned on in the browser via | ||
// adapter.disableLog(false), but then logging from the switch statement below | ||
// will not appear. | ||
require('./utils').disableLog(true); | ||
// require('./utils').disableLog(false); | ||
@@ -29,0 +29,0 @@ // Browser shims. |
@@ -231,2 +231,10 @@ | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim implicit creation of RTCSessionDescription/RTCIceCandidate | ||
@@ -233,0 +241,0 @@ ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] |
@@ -908,34 +908,40 @@ /* | ||
window.RTCPeerConnection.prototype.addIceCandidate = function(candidate) { | ||
var mLineIndex = candidate.sdpMLineIndex; | ||
if (candidate.sdpMid) { | ||
for (var i = 0; i < this.transceivers.length; i++) { | ||
if (this.transceivers[i].mid === candidate.sdpMid) { | ||
mLineIndex = i; | ||
break; | ||
if (candidate === null) { | ||
this.transceivers.forEach(function(transceiver) { | ||
transceiver.iceTransport.addIceCandidate({}); | ||
}); | ||
} else { | ||
var mLineIndex = candidate.sdpMLineIndex; | ||
if (candidate.sdpMid) { | ||
for (var i = 0; i < this.transceivers.length; i++) { | ||
if (this.transceivers[i].mid === candidate.sdpMid) { | ||
mLineIndex = i; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
var transceiver = this.transceivers[mLineIndex]; | ||
if (transceiver) { | ||
var cand = Object.keys(candidate.candidate).length > 0 ? | ||
SDPUtils.parseCandidate(candidate.candidate) : {}; | ||
// Ignore Chrome's invalid candidates since Edge does not like them. | ||
if (cand.protocol === 'tcp' && cand.port === 0) { | ||
return; | ||
var transceiver = this.transceivers[mLineIndex]; | ||
if (transceiver) { | ||
var cand = Object.keys(candidate.candidate).length > 0 ? | ||
SDPUtils.parseCandidate(candidate.candidate) : {}; | ||
// Ignore Chrome's invalid candidates since Edge does not like them. | ||
if (cand.protocol === 'tcp' && cand.port === 0) { | ||
return; | ||
} | ||
// Ignore RTCP candidates, we assume RTCP-MUX. | ||
if (cand.component !== '1') { | ||
return; | ||
} | ||
// A dirty hack to make samples work. | ||
if (cand.type === 'endOfCandidates') { | ||
cand = {}; | ||
} | ||
transceiver.iceTransport.addRemoteCandidate(cand); | ||
// update the remoteDescription. | ||
var sections = SDPUtils.splitSections(this.remoteDescription.sdp); | ||
sections[mLineIndex + 1] += (cand.type ? candidate.candidate.trim() | ||
: 'a=end-of-candidates') + '\r\n'; | ||
this.remoteDescription.sdp = sections.join(''); | ||
} | ||
// Ignore RTCP candidates, we assume RTCP-MUX. | ||
if (cand.component !== '1') { | ||
return; | ||
} | ||
// A dirty hack to make samples work. | ||
if (cand.type === 'endOfCandidates') { | ||
cand = {}; | ||
} | ||
transceiver.iceTransport.addRemoteCandidate(cand); | ||
// update the remoteDescription. | ||
var sections = SDPUtils.splitSections(this.remoteDescription.sdp); | ||
sections[mLineIndex + 1] += (cand.type ? candidate.candidate.trim() | ||
: 'a=end-of-candidates') + '\r\n'; | ||
this.remoteDescription.sdp = sections.join(''); | ||
} | ||
@@ -942,0 +948,0 @@ if (arguments.length > 1 && typeof arguments[1] === 'function') { |
@@ -121,2 +121,10 @@ /* | ||
// support for addIceCandidate(null) | ||
var nativeAddIceCandidate = | ||
RTCPeerConnection.prototype.addIceCandidate; | ||
RTCPeerConnection.prototype.addIceCandidate = function() { | ||
return arguments[0] === null ? Promise.resolve() | ||
: nativeAddIceCandidate.apply(this, arguments); | ||
}; | ||
// shim getStats with maplike support | ||
@@ -123,0 +131,0 @@ var makeMapStats = function(stats) { |
@@ -16,18 +16,19 @@ /* | ||
module.exports = function() { | ||
var shimError_ = e => ({ | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the user ' + | ||
'agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}); | ||
var shimError_ = function(e) { | ||
return { | ||
name: { | ||
SecurityError: 'NotAllowedError', | ||
PermissionDeniedError: 'NotAllowedError' | ||
}[e.name] || e.name, | ||
message: { | ||
'The operation is insecure.': 'The request is not allowed by the ' + | ||
'user agent or the platform in the current context.' | ||
}[e.message] || e.message, | ||
constraint: e.constraint, | ||
toString: function() { | ||
return this.name + (this.message && ': ') + this.message; | ||
} | ||
}; | ||
}; | ||
// getUserMedia constraints shim. | ||
@@ -89,4 +90,5 @@ var getUserMedia_ = function(constraints, onSuccess, onError) { | ||
} | ||
return navigator.mozGetUserMedia(constraints, onSuccess, | ||
e => onError(shimError_(e))); | ||
return navigator.mozGetUserMedia(constraints, onSuccess, function(e) { | ||
onError(shimError_(e)); | ||
}); | ||
}; | ||
@@ -137,5 +139,8 @@ | ||
bind(navigator.mediaDevices); | ||
navigator.mediaDevices.getUserMedia = c => | ||
origGetUserMedia(c).catch(e => Promise.reject(shimError_(e))); | ||
navigator.mediaDevices.getUserMedia = function(c) { | ||
return origGetUserMedia(c).catch(function(e) { | ||
return Promise.reject(shimError_(e)); | ||
}); | ||
}; | ||
} | ||
}; |
@@ -11,3 +11,3 @@ /* | ||
var logDisabled_ = false; | ||
var logDisabled_ = true; | ||
@@ -14,0 +14,0 @@ // Utility methods. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
723992
18441
77