webrtc-adapter
Advanced tools
Comparing version 8.2.0 to 8.2.1
@@ -50,3 +50,3 @@ /* | ||
args = JSON.parse(JSON.stringify(args)); | ||
args.candidate = args.candidate.substr(2); | ||
args.candidate = args.candidate.substring(2); | ||
} | ||
@@ -193,3 +193,3 @@ | ||
if (match.length > 0) { | ||
maxMessageSize = parseInt(match[0].substr(19), 10); | ||
maxMessageSize = parseInt(match[0].substring(19), 10); | ||
} else if (browserDetails.browser === 'firefox' && remoteIsFirefox !== -1) { | ||
@@ -196,0 +196,0 @@ // If the maximum message size is not present in the remote SDP and |
@@ -268,3 +268,3 @@ /* | ||
var server = pcConfig.iceServers[i]; | ||
if (!server.hasOwnProperty('urls') && server.hasOwnProperty('url')) { | ||
if (server.urls === undefined && server.url) { | ||
utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls'); | ||
@@ -271,0 +271,0 @@ server = JSON.parse(JSON.stringify(server)); |
@@ -40,3 +40,3 @@ 'use strict'; | ||
options: { | ||
configFile: '.eslintrc' | ||
overrideConfigFile: '.eslintrc' | ||
}, | ||
@@ -43,0 +43,0 @@ target: ['src/**/*.js', 'test/*.js', 'test/unit/*.js', 'test/e2e/*.js'] |
{ | ||
"name": "webrtc-adapter", | ||
"version": "8.2.0", | ||
"version": "8.2.1", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -28,3 +28,3 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"sdp": "^3.0.2" | ||
"sdp": "^3.2.0" | ||
}, | ||
@@ -36,3 +36,3 @@ "engines": { | ||
"devDependencies": { | ||
"babel-core": "^6.26.3", | ||
"@babel/core": "^7.21.0", | ||
"babel-preset-env": "^1.7.0", | ||
@@ -43,10 +43,10 @@ "brfs": "^1.5.0", | ||
"grunt-babel": "^7.0.0", | ||
"grunt-browserify": "^5.3.0", | ||
"grunt-browserify": "^6.0.0", | ||
"grunt-cli": "^1.3.1", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt-eslint": "^24.0.0", | ||
"grunt-shell": "^2.1.0", | ||
"karma": "^4.4.1", | ||
"karma-browserify": "^5.2.0", | ||
"karma": "^6.4.1", | ||
"karma-browserify": "^8.1.0", | ||
"karma-chai": "^0.1.0", | ||
@@ -59,7 +59,7 @@ "karma-chrome-launcher": "^2.2.0", | ||
"karma-stability-reporter": "^3.0.1", | ||
"mocha": "^5.2.0", | ||
"mocha": "^10.1.0", | ||
"sinon": "^2.2.0", | ||
"sinon-chai": "^2.14.0", | ||
"travis-multirunner": "^4.6.0" | ||
"travis-multirunner": "^5.0.1" | ||
} | ||
} |
@@ -10,3 +10,3 @@ /* | ||
// Browser shims. | ||
// Browser shims. | ||
import * as chromeShim from './chrome/chrome_shim'; | ||
@@ -13,0 +13,0 @@ import * as firefoxShim from './firefox/firefox_shim'; |
@@ -8,3 +8,3 @@ /* | ||
*/ | ||
/* eslint-env node */ | ||
/* eslint-env node */ | ||
'use strict'; | ||
@@ -403,3 +403,3 @@ import * as utils from '../utils.js'; | ||
throw new DOMException('Track already exists.', | ||
'InvalidAccessError'); | ||
'InvalidAccessError'); | ||
} | ||
@@ -454,3 +454,3 @@ }); | ||
const origGetLocalStreams = window.RTCPeerConnection.prototype | ||
.getLocalStreams; | ||
.getLocalStreams; | ||
window.RTCPeerConnection.prototype.getLocalStreams = | ||
@@ -472,3 +472,3 @@ function getLocalStreams() { | ||
throw new DOMException('Track already exists.', | ||
'InvalidAccessError'); | ||
'InvalidAccessError'); | ||
} | ||
@@ -495,3 +495,3 @@ }); | ||
delete this._reverseStreams[(this._streams[stream.id] ? | ||
this._streams[stream.id].id : stream.id)]; | ||
this._streams[stream.id].id : stream.id)]; | ||
delete this._streams[stream.id]; | ||
@@ -521,3 +521,3 @@ }; | ||
throw new DOMException('Track already exists.', | ||
'InvalidAccessError'); | ||
'InvalidAccessError'); | ||
} | ||
@@ -556,3 +556,3 @@ | ||
sdp = sdp.replace(new RegExp(internalStream.id, 'g'), | ||
externalStream.id); | ||
externalStream.id); | ||
}); | ||
@@ -570,3 +570,3 @@ return new RTCSessionDescription({ | ||
sdp = sdp.replace(new RegExp(externalStream.id, 'g'), | ||
internalStream.id); | ||
internalStream.id); | ||
}); | ||
@@ -598,3 +598,3 @@ return new RTCSessionDescription({ | ||
return nativeMethod.apply(this, arguments) | ||
.then(description => replaceInternalStreamId(this, description)); | ||
.then(description => replaceInternalStreamId(this, description)); | ||
}}; | ||
@@ -618,13 +618,13 @@ window.RTCPeerConnection.prototype[method] = methodObj[method]; | ||
const origLocalDescription = Object.getOwnPropertyDescriptor( | ||
window.RTCPeerConnection.prototype, 'localDescription'); | ||
window.RTCPeerConnection.prototype, 'localDescription'); | ||
Object.defineProperty(window.RTCPeerConnection.prototype, | ||
'localDescription', { | ||
get() { | ||
const description = origLocalDescription.get.apply(this); | ||
if (description.type === '') { | ||
return description; | ||
} | ||
return replaceInternalStreamId(this, description); | ||
'localDescription', { | ||
get() { | ||
const description = origLocalDescription.get.apply(this); | ||
if (description.type === '') { | ||
return description; | ||
} | ||
}); | ||
return replaceInternalStreamId(this, description); | ||
} | ||
}); | ||
@@ -647,3 +647,3 @@ window.RTCPeerConnection.prototype.removeTrack = | ||
throw new DOMException('Sender was not created by this connection.', | ||
'InvalidAccessError'); | ||
'InvalidAccessError'); | ||
} | ||
@@ -688,12 +688,12 @@ | ||
['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] | ||
.forEach(function(method) { | ||
const nativeMethod = window.RTCPeerConnection.prototype[method]; | ||
const methodObj = {[method]() { | ||
arguments[0] = new ((method === 'addIceCandidate') ? | ||
window.RTCIceCandidate : | ||
window.RTCSessionDescription)(arguments[0]); | ||
return nativeMethod.apply(this, arguments); | ||
}}; | ||
window.RTCPeerConnection.prototype[method] = methodObj[method]; | ||
}); | ||
.forEach(function(method) { | ||
const nativeMethod = window.RTCPeerConnection.prototype[method]; | ||
const methodObj = {[method]() { | ||
arguments[0] = new ((method === 'addIceCandidate') ? | ||
window.RTCIceCandidate : | ||
window.RTCSessionDescription)(arguments[0]); | ||
return nativeMethod.apply(this, arguments); | ||
}}; | ||
window.RTCPeerConnection.prototype[method] = methodObj[method]; | ||
}); | ||
} | ||
@@ -700,0 +700,0 @@ } |
@@ -109,17 +109,18 @@ /* | ||
return navigator.mediaDevices.enumerateDevices() | ||
.then(devices => { | ||
devices = devices.filter(d => d.kind === 'videoinput'); | ||
let dev = devices.find(d => matches.some(match => | ||
d.label.toLowerCase().includes(match))); | ||
if (!dev && devices.length && matches.includes('back')) { | ||
dev = devices[devices.length - 1]; // more likely the back cam | ||
} | ||
if (dev) { | ||
constraints.video.deviceId = face.exact ? {exact: dev.deviceId} : | ||
{ideal: dev.deviceId}; | ||
} | ||
constraints.video = constraintsToChrome_(constraints.video); | ||
logging('chrome: ' + JSON.stringify(constraints)); | ||
return func(constraints); | ||
}); | ||
.then(devices => { | ||
devices = devices.filter(d => d.kind === 'videoinput'); | ||
let dev = devices.find(d => matches.some(match => | ||
d.label.toLowerCase().includes(match))); | ||
if (!dev && devices.length && matches.includes('back')) { | ||
dev = devices[devices.length - 1]; // more likely the back cam | ||
} | ||
if (dev) { | ||
constraints.video.deviceId = face.exact | ||
? {exact: dev.deviceId} | ||
: {ideal: dev.deviceId}; | ||
} | ||
constraints.video = constraintsToChrome_(constraints.video); | ||
logging('chrome: ' + JSON.stringify(constraints)); | ||
return func(constraints); | ||
}); | ||
} | ||
@@ -175,3 +176,3 @@ } | ||
const origGetUserMedia = navigator.mediaDevices.getUserMedia. | ||
bind(navigator.mediaDevices); | ||
bind(navigator.mediaDevices); | ||
navigator.mediaDevices.getUserMedia = function(cs) { | ||
@@ -178,0 +179,0 @@ return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => { |
@@ -28,3 +28,3 @@ /* | ||
args = JSON.parse(JSON.stringify(args)); | ||
args.candidate = args.candidate.substr(2); | ||
args.candidate = args.candidate.substring(2); | ||
} | ||
@@ -37,3 +37,3 @@ | ||
const augmentedCandidate = Object.assign(nativeCandidate, | ||
parsedCandidate); | ||
parsedCandidate); | ||
@@ -178,3 +178,3 @@ // Add a serializer that does not serialize the extra attributes. | ||
if (match.length > 0) { | ||
maxMessageSize = parseInt(match[0].substr(19), 10); | ||
maxMessageSize = parseInt(match[0].substring(19), 10); | ||
} else if (browserDetails.browser === 'firefox' && | ||
@@ -314,3 +314,3 @@ remoteIsFirefox !== -1) { | ||
this.removeEventListener('connectionstatechange', | ||
this._onconnectionstatechange); | ||
this._onconnectionstatechange); | ||
delete this._onconnectionstatechange; | ||
@@ -320,3 +320,3 @@ } | ||
this.addEventListener('connectionstatechange', | ||
this._onconnectionstatechange = cb); | ||
this._onconnectionstatechange = cb); | ||
} | ||
@@ -323,0 +323,0 @@ }, |
@@ -40,12 +40,12 @@ /* | ||
['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] | ||
.forEach(function(method) { | ||
const nativeMethod = window.RTCPeerConnection.prototype[method]; | ||
const methodObj = {[method]() { | ||
arguments[0] = new ((method === 'addIceCandidate') ? | ||
window.RTCIceCandidate : | ||
window.RTCSessionDescription)(arguments[0]); | ||
return nativeMethod.apply(this, arguments); | ||
}}; | ||
window.RTCPeerConnection.prototype[method] = methodObj[method]; | ||
}); | ||
.forEach(function(method) { | ||
const nativeMethod = window.RTCPeerConnection.prototype[method]; | ||
const methodObj = {[method]() { | ||
arguments[0] = new ((method === 'addIceCandidate') ? | ||
window.RTCIceCandidate : | ||
window.RTCSessionDescription)(arguments[0]); | ||
return nativeMethod.apply(this, arguments); | ||
}}; | ||
window.RTCPeerConnection.prototype[method] = methodObj[method]; | ||
}); | ||
} | ||
@@ -118,3 +118,3 @@ | ||
return this.track ? this._pc.getStats(this.track) : | ||
Promise.resolve(new Map()); | ||
Promise.resolve(new Map()); | ||
}; | ||
@@ -271,8 +271,8 @@ } | ||
return Promise.all(this.setParametersPromises) | ||
.then(() => { | ||
return origCreateOffer.apply(this, arguments); | ||
}) | ||
.finally(() => { | ||
this.setParametersPromises = []; | ||
}); | ||
.then(() => { | ||
return origCreateOffer.apply(this, arguments); | ||
}) | ||
.finally(() => { | ||
this.setParametersPromises = []; | ||
}); | ||
} | ||
@@ -294,8 +294,8 @@ return origCreateOffer.apply(this, arguments); | ||
return Promise.all(this.setParametersPromises) | ||
.then(() => { | ||
return origCreateAnswer.apply(this, arguments); | ||
}) | ||
.finally(() => { | ||
this.setParametersPromises = []; | ||
}); | ||
.then(() => { | ||
return origCreateAnswer.apply(this, arguments); | ||
}) | ||
.finally(() => { | ||
this.setParametersPromises = []; | ||
}); | ||
} | ||
@@ -302,0 +302,0 @@ return origCreateAnswer.apply(this, arguments); |
@@ -20,3 +20,3 @@ /* | ||
utils.deprecated('navigator.getUserMedia', | ||
'navigator.mediaDevices.getUserMedia'); | ||
'navigator.mediaDevices.getUserMedia'); | ||
navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError); | ||
@@ -35,3 +35,3 @@ }; | ||
const nativeGetUserMedia = navigator.mediaDevices.getUserMedia. | ||
bind(navigator.mediaDevices); | ||
bind(navigator.mediaDevices); | ||
navigator.mediaDevices.getUserMedia = function(c) { | ||
@@ -38,0 +38,0 @@ if (typeof c === 'object' && typeof c.audio === 'object') { |
@@ -219,3 +219,3 @@ /* | ||
navigator.mediaDevices.getUserMedia(constraints) | ||
.then(cb, errcb); | ||
.then(cb, errcb); | ||
}.bind(navigator); | ||
@@ -248,4 +248,3 @@ } | ||
let server = pcConfig.iceServers[i]; | ||
if (!server.hasOwnProperty('urls') && | ||
server.hasOwnProperty('url')) { | ||
if (server.urls === undefined && server.url) { | ||
utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls'); | ||
@@ -252,0 +251,0 @@ server = JSON.parse(JSON.stringify(server)); |
@@ -8,3 +8,3 @@ /* | ||
*/ | ||
/* eslint-env node */ | ||
/* eslint-env node */ | ||
'use strict'; | ||
@@ -88,3 +88,3 @@ | ||
this.removeEventListener(eventNameToWrap, | ||
this['_on' + eventNameToWrap]); | ||
this['_on' + eventNameToWrap]); | ||
delete this['_on' + eventNameToWrap]; | ||
@@ -94,3 +94,3 @@ } | ||
this.addEventListener(eventNameToWrap, | ||
this['_on' + eventNameToWrap] = cb); | ||
this['_on' + eventNameToWrap] = cb); | ||
} | ||
@@ -110,3 +110,3 @@ }, | ||
return (bool) ? 'adapter.js logging disabled' : | ||
'adapter.js logging enabled'; | ||
'adapter.js logging enabled'; | ||
} | ||
@@ -170,3 +170,3 @@ | ||
result.version = extractVersion(navigator.userAgent, | ||
/Firefox\/(\d+)\./, 1); | ||
/Firefox\/(\d+)\./, 1); | ||
} else if (navigator.webkitGetUserMedia || | ||
@@ -180,3 +180,3 @@ (window.isSecureContext === false && window.webkitRTCPeerConnection)) { | ||
result.version = extractVersion(navigator.userAgent, | ||
/Chrom(e|ium)\/(\d+)\./, 2); | ||
/Chrom(e|ium)\/(\d+)\./, 2); | ||
} else if (window.RTCPeerConnection && | ||
@@ -186,3 +186,3 @@ navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari. | ||
result.version = extractVersion(navigator.userAgent, | ||
/AppleWebKit\/(\d+)\./, 1); | ||
/AppleWebKit\/(\d+)\./, 1); | ||
result.supportsUnifiedPlan = window.RTCRtpTransceiver && | ||
@@ -189,0 +189,0 @@ 'currentDirection' in window.RTCRtpTransceiver.prototype; |
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
533672
37
11673
Updatedsdp@^3.2.0