webrtc-adapter
Advanced tools
Comparing version 6.2.1 to 6.3.0
{ | ||
"name": "webrtc-adapter", | ||
"version": "6.2.1", | ||
"version": "6.3.0", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -36,3 +36,3 @@ "license": "BSD-3-Clause", | ||
"grunt-cli": ">=0.1.9", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
@@ -51,3 +51,3 @@ "grunt-eslint": "^19.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-stability-reporter": "git+https://github.com/fippo/karma-stability-reporter.git#v2.1.0", | ||
"karma-stability-reporter": "^3.0.1", | ||
"mocha": "^3.2.0", | ||
@@ -54,0 +54,0 @@ "sinon": "^2.2.0", |
@@ -77,2 +77,3 @@ /* | ||
chromeShim.shimSenderReceiverGetStats(window); | ||
chromeShim.fixNegotiationNeeded(window); | ||
@@ -79,0 +80,0 @@ commonShim.shimRTCIceCandidate(window); |
@@ -73,3 +73,5 @@ | ||
this.addEventListener('track', this._ontrack = f); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
@@ -902,3 +904,39 @@ var origSetRemoteDescription = | ||
}; | ||
}, | ||
fixNegotiationNeeded: function(window) { | ||
utils.wrapPeerConnectionEvent(window, 'negotiationneeded', function(e) { | ||
var pc = e.target; | ||
if (pc.signalingState !== 'stable') { | ||
return; | ||
} | ||
return e; | ||
}); | ||
}, | ||
shimGetDisplayMedia: function(window, getSourceId) { | ||
if ('getDisplayMedia' in window.navigator) { | ||
return; | ||
} | ||
// getSourceId is a function that returns a promise resolving with | ||
// the sourceId of the screen/window/tab to be shared. | ||
if (typeof getSourceId !== 'function') { | ||
console.error('shimGetDisplayMedia: getSourceId argument is not ' + | ||
'a function'); | ||
return; | ||
} | ||
navigator.getDisplayMedia = function(constraints) { | ||
return getSourceId(constraints) | ||
.then(function(sourceId) { | ||
constraints.video = { | ||
mandatory: { | ||
chromeMediaSource: 'desktop', | ||
chromeMediaSourceId: sourceId, | ||
maxFrameRate: constraints.video.frameRate || 3 | ||
} | ||
}; | ||
return navigator.mediaDevices.getUserMedia(constraints); | ||
}); | ||
}; | ||
} | ||
}; |
@@ -151,3 +151,3 @@ /* | ||
message: e.message, | ||
constraint: e.constraintName, | ||
constraint: e.constraint || e.constraintName, | ||
toString: function() { | ||
@@ -154,0 +154,0 @@ return this.name + (this.message && ': ') + this.message; |
@@ -287,2 +287,24 @@ /* | ||
}, | ||
shimGetDisplayMedia: function(window, preferredMediaSource) { | ||
if ('getDisplayMedia' in window.navigator) { | ||
return; | ||
} | ||
navigator.getDisplayMedia = function(constraints) { | ||
if (!(constraints && constraints.video)) { | ||
var err = new DOMException('getDisplayMedia without video ' + | ||
'constraints is undefined'); | ||
err.name = 'NotFoundError'; | ||
// from https://heycam.github.io/webidl/#idl-DOMException-error-names | ||
err.code = 8; | ||
return Promise.reject(err); | ||
} | ||
if (constraints.video === true) { | ||
constraints.video = {mediaSource: preferredMediaSource}; | ||
} else { | ||
constraints.video.mediaSource = preferredMediaSource; | ||
} | ||
return navigator.mediaDevices.getUserMedia(constraints); | ||
}; | ||
} | ||
}; |
@@ -28,3 +28,4 @@ /* | ||
// Wraps the peerconnection event eventNameToWrap in a function | ||
// which returns the modified event object. | ||
// which returns the modified event object (or false to prevent | ||
// the event). | ||
function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) { | ||
@@ -41,3 +42,6 @@ if (!window.RTCPeerConnection) { | ||
var wrappedCallback = function(e) { | ||
cb(wrapper(e)); | ||
var modifiedEvent = wrapper(e); | ||
if (modifiedEvent) { | ||
cb(modifiedEvent); | ||
} | ||
}; | ||
@@ -44,0 +48,0 @@ this._eventMap = this._eventMap || {}; |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
21614
844406