webrtc-adapter
Advanced tools
Comparing version 7.5.0 to 7.5.1
@@ -65,10 +65,17 @@ /* | ||
window.RTCPeerConnection.prototype.addTrack = function addTrack(track) { | ||
var stream = arguments[1]; | ||
if (stream) { | ||
if (!this._localStreams) { | ||
this._localStreams = [stream]; | ||
} else if (!this._localStreams.includes(stream)) { | ||
this._localStreams.push(stream); | ||
} | ||
var _this2 = this; | ||
for (var _len = arguments.length, streams = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
streams[_key - 1] = arguments[_key]; | ||
} | ||
if (streams) { | ||
streams.forEach(function (stream) { | ||
if (!_this2._localStreams) { | ||
_this2._localStreams = [stream]; | ||
} else if (!_this2._localStreams.includes(stream)) { | ||
_this2._localStreams.push(stream); | ||
} | ||
}); | ||
} | ||
return _addTrack.apply(this, arguments); | ||
@@ -79,3 +86,3 @@ }; | ||
window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -93,3 +100,3 @@ if (!this._localStreams) { | ||
if (tracks.includes(sender.track)) { | ||
_this2.removeTrack(sender); | ||
_this3.removeTrack(sender); | ||
} | ||
@@ -116,3 +123,3 @@ }); | ||
set: function set(f) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
@@ -126,12 +133,12 @@ if (this._onaddstream) { | ||
e.streams.forEach(function (stream) { | ||
if (!_this3._remoteStreams) { | ||
_this3._remoteStreams = []; | ||
if (!_this4._remoteStreams) { | ||
_this4._remoteStreams = []; | ||
} | ||
if (_this3._remoteStreams.includes(stream)) { | ||
if (_this4._remoteStreams.includes(stream)) { | ||
return; | ||
} | ||
_this3._remoteStreams.push(stream); | ||
_this4._remoteStreams.push(stream); | ||
var event = new Event('addstream'); | ||
event.stream = stream; | ||
_this3.dispatchEvent(event); | ||
_this4.dispatchEvent(event); | ||
}); | ||
@@ -138,0 +145,0 @@ }); |
{ | ||
"name": "webrtc-adapter", | ||
"version": "7.5.0", | ||
"version": "7.5.1", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
[![Build Status](https://travis-ci.org/webrtcHacks/adapter.svg)](https://travis-ci.org/webrtcHacks/adapter) | ||
# WebRTC adapter # | ||
adapter.js is a shim to insulate apps from spec changes and prefix differences. In fact, the standards and protocols used for WebRTC implementations are highly stable, and there are only a few prefixed names. For full interop information, see [webrtc.org/web-apis/interop](https://www.webrtc.org/web-apis/interop). | ||
adapter.js is a shim to insulate apps from spec changes and prefix differences in WebRTC. The prefix differences are mostly gone these days but differences in behaviour between browsers remain. | ||
This repository used to be part of the WebRTC organisation on github but moved. We aim to keep | ||
the old repository updated with new releases. | ||
This repository used to be part of the WebRTC organisation on github but moved. We aim to keep the old repository updated with new releases. | ||
@@ -27,3 +26,12 @@ ## Install ## | ||
``` | ||
No further action is required. | ||
No further action is required. You might want to use adapters browser detection | ||
which detects which webrtc quirks are required. You can look at | ||
``` | ||
adapter.browserDetails.browser | ||
``` | ||
for webrtc engine detection (which will for example detect Opera or the Chromium based Edge as 'chrome') and | ||
``` | ||
adapter.browserDetails.version | ||
``` | ||
for the version according to the user-agent string. | ||
@@ -30,0 +38,0 @@ ##### NPM |
@@ -42,10 +42,11 @@ /* | ||
window.RTCPeerConnection.prototype.addTrack = | ||
function addTrack(track) { | ||
const stream = arguments[1]; | ||
if (stream) { | ||
if (!this._localStreams) { | ||
this._localStreams = [stream]; | ||
} else if (!this._localStreams.includes(stream)) { | ||
this._localStreams.push(stream); | ||
} | ||
function addTrack(track, ...streams) { | ||
if (streams) { | ||
streams.forEach((stream) => { | ||
if (!this._localStreams) { | ||
this._localStreams = [stream]; | ||
} else if (!this._localStreams.includes(stream)) { | ||
this._localStreams.push(stream); | ||
} | ||
}); | ||
} | ||
@@ -52,0 +53,0 @@ return _addTrack.apply(this, arguments); |
Sorry, the diff of this file is not supported yet
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
894156
21403
84