webrtc-adapter
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -215,3 +215,4 @@ (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){ | ||
return origGetStats.apply(this, [successCallbackWrapper_, arguments[0]]); | ||
return origGetStats.apply(this, [successCallbackWrapper_, | ||
arguments[0]]); | ||
} | ||
@@ -221,3 +222,3 @@ | ||
return new Promise(function(resolve, reject) { | ||
if (args.length === 1 && selector === null) { | ||
if (args.length === 1 && typeof selector === 'object') { | ||
origGetStats.apply(self, [ | ||
@@ -314,3 +315,3 @@ function(response) { | ||
} | ||
} | ||
}; | ||
@@ -409,3 +410,3 @@ | ||
}); | ||
} | ||
}; | ||
@@ -486,3 +487,2 @@ if (!navigator.mediaDevices) { | ||
set: function(f) { | ||
var self = this; | ||
if (this._ontrack) { | ||
@@ -586,3 +586,4 @@ this.removeEventListener('track', this._ontrack); | ||
Object.keys(c).forEach(function(key) { | ||
if (key === 'require' || key === 'advanced' || key === 'mediaSource') { | ||
if (key === 'require' || key === 'advanced' || | ||
key === 'mediaSource') { | ||
return; | ||
@@ -644,3 +645,3 @@ } | ||
}); | ||
} | ||
}; | ||
@@ -690,3 +691,3 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; | ||
@@ -701,3 +702,3 @@ // Expose public methods. | ||
reattachMediaStream: firefoxShim.reattachMediaStream | ||
} | ||
}; | ||
@@ -784,3 +785,3 @@ },{"../utils":7,"./getusermedia":6}],6:[function(require,module,exports){ | ||
}); | ||
} | ||
}; | ||
@@ -818,3 +819,3 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; | ||
@@ -854,4 +855,5 @@ },{"../utils":7}],7:[function(require,module,exports){ | ||
/** | ||
/** | ||
* Extract browser version out of the provided user agent string. | ||
* | ||
* @param {!string} uastring userAgent string. | ||
@@ -869,2 +871,3 @@ * @param {!string} expr Regular expression used as match criteria. | ||
* Browser detector. | ||
* | ||
* @return {object} result containing browser, version and minVersion | ||
@@ -871,0 +874,0 @@ * properties. |
@@ -215,3 +215,4 @@ (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){ | ||
return origGetStats.apply(this, [successCallbackWrapper_, arguments[0]]); | ||
return origGetStats.apply(this, [successCallbackWrapper_, | ||
arguments[0]]); | ||
} | ||
@@ -221,3 +222,3 @@ | ||
return new Promise(function(resolve, reject) { | ||
if (args.length === 1 && selector === null) { | ||
if (args.length === 1 && typeof selector === 'object') { | ||
origGetStats.apply(self, [ | ||
@@ -314,3 +315,3 @@ function(response) { | ||
} | ||
} | ||
}; | ||
@@ -409,3 +410,3 @@ | ||
}); | ||
} | ||
}; | ||
@@ -486,3 +487,2 @@ if (!navigator.mediaDevices) { | ||
set: function(f) { | ||
var self = this; | ||
if (this._ontrack) { | ||
@@ -586,3 +586,4 @@ this.removeEventListener('track', this._ontrack); | ||
Object.keys(c).forEach(function(key) { | ||
if (key === 'require' || key === 'advanced' || key === 'mediaSource') { | ||
if (key === 'require' || key === 'advanced' || | ||
key === 'mediaSource') { | ||
return; | ||
@@ -644,3 +645,3 @@ } | ||
}); | ||
} | ||
}; | ||
@@ -690,3 +691,3 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; | ||
@@ -701,3 +702,3 @@ // Expose public methods. | ||
reattachMediaStream: firefoxShim.reattachMediaStream | ||
} | ||
}; | ||
@@ -784,3 +785,3 @@ },{"../utils":7,"./getusermedia":6}],6:[function(require,module,exports){ | ||
}); | ||
} | ||
}; | ||
@@ -818,3 +819,3 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; | ||
@@ -854,4 +855,5 @@ },{"../utils":7}],7:[function(require,module,exports){ | ||
/** | ||
/** | ||
* Extract browser version out of the provided user agent string. | ||
* | ||
* @param {!string} uastring userAgent string. | ||
@@ -869,2 +871,3 @@ * @param {!string} expr Regular expression used as match criteria. | ||
* Browser detector. | ||
* | ||
* @return {object} result containing browser, version and minVersion | ||
@@ -871,0 +874,0 @@ * properties. |
{ | ||
"name": "webrtc-adapter", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -15,2 +15,5 @@ "license": "BSD-3-Clause", | ||
"scripts": { | ||
"preversion": "git stash && git checkout master && git pull && grunt && test/run-tests | faucet && git checkout -B bumpVersion", | ||
"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 && npm publish", | ||
"prepublish": "grunt build", | ||
@@ -17,0 +20,0 @@ "test": "grunt && test/run-tests | faucet" |
@@ -49,1 +49,9 @@ [![Build Status](https://travis-ci.org/webrtc/adapter.svg)](https://travis-ci.org/webrtc/adapter) | ||
Head over to [test/README.md](https://github.com/webrtc/samples/blob/gh-pages/test/README.md) and get started developing. | ||
## Publish a new version ## | ||
* Go the the adapter repository root directory | ||
* Make sure your repository is clean, i.e. no untracked files etc | ||
* Run `npm version patch -m 'bump to %s'` and type in your password lots of times (setting up credential caching is probably a good idea). | ||
* Done! There should now be a new release published to NPM and the gh-pages branch. | ||
Note: Currently only tested on Linux, not sure about Mac but will definitely not work on Windows. |
@@ -135,3 +135,4 @@ /* | ||
return origGetStats.apply(this, [successCallbackWrapper_, arguments[0]]); | ||
return origGetStats.apply(this, [successCallbackWrapper_, | ||
arguments[0]]); | ||
} | ||
@@ -141,3 +142,3 @@ | ||
return new Promise(function(resolve, reject) { | ||
if (args.length === 1 && selector === null) { | ||
if (args.length === 1 && typeof selector === 'object') { | ||
origGetStats.apply(self, [ | ||
@@ -234,3 +235,3 @@ function(response) { | ||
} | ||
} | ||
}; | ||
@@ -237,0 +238,0 @@ |
@@ -81,3 +81,3 @@ /* | ||
}); | ||
} | ||
}; | ||
@@ -84,0 +84,0 @@ if (!navigator.mediaDevices) { |
@@ -22,3 +22,2 @@ /* | ||
// Splits SDP into lines, dealing with both CRLF and LF. | ||
@@ -138,2 +137,18 @@ SDPUtils.splitLines = function(blob) { | ||
// Parses an a=extmap line (headerextension from RFC 5285). Sample input: | ||
// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset | ||
SDPUtils.parseExtmap = function(line) { | ||
var parts = line.substr(9).split(' '); | ||
return { | ||
id: parseInt(parts[0], 10), | ||
uri: parts[1] | ||
}; | ||
}; | ||
// Generates a=extmap line from RTCRtpHeaderExtensionParameters or RTCRtpHeaderExtension. | ||
SDPUtils.writeExtmap = function(headerExtension) { | ||
return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) + | ||
' ' + headerExtension.uri + '\r\n'; | ||
}; | ||
// Parses an ftmp line, returns dictionary. Sample input: | ||
@@ -201,3 +216,3 @@ // a=fmtp:96 vbr=on;cng=on | ||
var parts = { | ||
ssrc: line.substr(7, sp - 7), | ||
ssrc: line.substr(7, sp - 7) | ||
}; | ||
@@ -289,5 +304,14 @@ var colon = line.indexOf(':', sp); | ||
description.codecs.push(codec); | ||
switch(codec.name.toUpperCase()) { | ||
case 'RED': | ||
case 'ULPFEC': | ||
description.fecMechanisms.push(codec.name.toUpperCase()); | ||
break; | ||
} | ||
} | ||
} | ||
// FIXME: parse headerExtensions, fecMechanisms and rtcp. | ||
SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) { | ||
description.headerExtensions.push(SDPUtils.parseExtmap(line)); | ||
}); | ||
// FIXME: parse rtcp. | ||
return description; | ||
@@ -294,0 +318,0 @@ }; |
@@ -12,3 +12,2 @@ /* | ||
var logging = require('../utils').log; | ||
var browserDetails = require('../utils').browserDetails; | ||
@@ -118,8 +117,12 @@ var edgeShim = { | ||
for (var j = 1; j < sections.length; j++) { | ||
sections[j] += 'a=end-of-candidates\r\n'; | ||
if (sections[j].indexOf('\r\na=end-of-candidates\r\n') === -1) { | ||
sections[j] += 'a=end-of-candidates\r\n'; | ||
} | ||
} | ||
} else { | ||
} else if (event.candidate.candidate.indexOf('typ endOfCandidates') | ||
=== -1) { | ||
sections[event.candidate.sdpMLineIndex + 1] += | ||
'a=' + event.candidate.candidate + '\r\n'; | ||
} | ||
self.localDescription.sdp = sections.join(''); | ||
self.dispatchEvent(event); | ||
@@ -129,8 +132,13 @@ if (self.onicecandidate !== null) { | ||
} | ||
if (!event.candidate) { | ||
self.iceGatheringState = 'complete'; | ||
if (!event.candidate && self.iceGatheringState !== 'complete') { | ||
var complete = self.transceivers.every(function(transceiver) { | ||
return transceiver.iceGatherer && | ||
transceiver.iceGatherer.state === 'completed'; | ||
}); | ||
if (complete) { | ||
self.iceGatheringState = 'complete'; | ||
} | ||
} | ||
}); | ||
this._localIceCandidatesBuffer = []; | ||
this.localDescription.sdp = sections.join(''); | ||
}; | ||
@@ -226,12 +234,2 @@ | ||
}); | ||
// update .localDescription with candidate and (potentially) end-of-candidates. | ||
// To make this harder, the gatherer might emit candidates before localdescription | ||
// is set. To make things worse, gather.getLocalCandidates still errors in | ||
// Edge 10547 when no candidates have been gathered yet. | ||
if (self.localDescription && self.localDescription.type !== '') { | ||
var sections = SDPUtils.splitSections(self.localDescription.sdp); | ||
sections[sdpMLineIndex + 1] += (!end ? 'a=' + event.candidate.candidate : | ||
'a=end-of-candidates') + '\r\n'; | ||
self.localDescription.sdp = sections.join(''); | ||
} | ||
@@ -243,3 +241,3 @@ // Emit candidate if localDescription is set. | ||
self._localIceCandidatesBuffer.push(event); | ||
if (complete) { | ||
if (end && complete) { | ||
self._localIceCandidatesBuffer.push(new Event('icecandidate')); | ||
@@ -318,5 +316,15 @@ } | ||
var self = this; | ||
var sections; | ||
var sessionpart; | ||
if (description.type === 'offer') { | ||
if (!this._pendingOffer) { | ||
} else { | ||
} else { | ||
// VERY limited support for SDP munging. Limited to: | ||
// * changing the order of codecs | ||
sections = SDPUtils.splitSections(description.sdp); | ||
sessionpart = sections.shift(); | ||
sections.forEach(function(mediaSection, sdpMLineIndex) { | ||
var caps = SDPUtils.parseRtpParameters(mediaSection); | ||
self._pendingOffer[sdpMLineIndex].localCapabilities = caps; | ||
}); | ||
this.transceivers = this._pendingOffer; | ||
@@ -326,4 +334,4 @@ delete this._pendingOffer; | ||
} else if (description.type === 'answer') { | ||
var sections = SDPUtils.splitSections(self.remoteDescription.sdp); | ||
var sessionpart = sections.shift(); | ||
sections = SDPUtils.splitSections(self.remoteDescription.sdp); | ||
sessionpart = sections.shift(); | ||
sections.forEach(function(mediaSection, sdpMLineIndex) { | ||
@@ -454,4 +462,16 @@ var transceiver = self.transceivers[sdpMLineIndex]; | ||
var isComplete = SDPUtils.matchPrefix(mediaSection, | ||
'a=end-of-candidates').length > 0; | ||
var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:') | ||
.map(function(cand) { | ||
return SDPUtils.parseCandidate(cand); | ||
}) | ||
.filter(function(cand) { | ||
return cand.component === '1'; | ||
}); | ||
if (description.type === 'offer') { | ||
var transports = self._createIceAndDtlsTransports(mid, sdpMLineIndex); | ||
if (isComplete) { | ||
transports.iceTransport.setRemoteCandidates(cands); | ||
} | ||
@@ -511,2 +531,5 @@ localCapabilities = RTCRtpReceiver.getCapabilities(kind); | ||
if (isComplete) { | ||
iceTransport.setRemoteCandidates(cands); | ||
} | ||
iceTransport.start(iceGatherer, remoteIceParameters, 'controlling'); | ||
@@ -900,3 +923,3 @@ dtlsTransport.start(remoteDtlsParameters); | ||
} | ||
} | ||
}; | ||
@@ -908,3 +931,2 @@ // Expose public methods. | ||
reattachMediaStream: edgeShim.reattachMediaStream | ||
} | ||
}; |
@@ -20,3 +20,2 @@ /* | ||
set: function(f) { | ||
var self = this; | ||
if (this._ontrack) { | ||
@@ -120,3 +119,4 @@ this.removeEventListener('track', this._ontrack); | ||
Object.keys(c).forEach(function(key) { | ||
if (key === 'require' || key === 'advanced' || key === 'mediaSource') { | ||
if (key === 'require' || key === 'advanced' || | ||
key === 'mediaSource') { | ||
return; | ||
@@ -178,3 +178,3 @@ } | ||
}); | ||
} | ||
}; | ||
@@ -224,3 +224,3 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; | ||
@@ -235,2 +235,2 @@ // Expose public methods. | ||
reattachMediaStream: firefoxShim.reattachMediaStream | ||
} | ||
}; |
@@ -80,3 +80,3 @@ /* | ||
}); | ||
} | ||
}; | ||
@@ -114,2 +114,2 @@ // Shim for mediaDevices on older versions. | ||
} | ||
} | ||
}; |
@@ -33,4 +33,5 @@ /* | ||
/** | ||
/** | ||
* Extract browser version out of the provided user agent string. | ||
* | ||
* @param {!string} uastring userAgent string. | ||
@@ -48,2 +49,3 @@ * @param {!string} expr Regular expression used as match criteria. | ||
* Browser detector. | ||
* | ||
* @return {object} result containing browser, version and minVersion | ||
@@ -50,0 +52,0 @@ * properties. |
@@ -19,2 +19,5 @@ /* | ||
// Edge SDP tests. Run in node. | ||
require('./sdp'); | ||
// This is run as a test so it is executed after all tests | ||
@@ -21,0 +24,0 @@ // have completed. |
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
394753
33
10305
57
36