Skip to content

Commit cc81d14

Browse files
Merge pull request #368 from webrtc/bumpVersion
bump to 2.0.4
2 parents 5afb7d9 + eb862c4 commit cc81d14

File tree

5 files changed

+119
-9
lines changed

5 files changed

+119
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webrtc-adapter",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences",
55
"license": "BSD-3-Clause",
66
"main": "./src/js/adapter_core.js",

release/adapter.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,16 @@ module.exports = function() {
10171017
bind(navigator.mediaDevices);
10181018
navigator.mediaDevices.getUserMedia = function(cs) {
10191019
return shimConstraints_(cs, function(c) {
1020-
return origGetUserMedia(c).catch(function(e) {
1020+
return origGetUserMedia(c).then(function(stream) {
1021+
if (c.audio && !stream.getAudioTracks().length ||
1022+
c.video && !stream.getVideoTracks().length) {
1023+
stream.getTracks().forEach(function(track) {
1024+
track.stop();
1025+
});
1026+
throw new DOMException('', 'NotFoundError');
1027+
}
1028+
return stream;
1029+
}, function(e) {
10211030
return Promise.reject(shimError_(e));
10221031
});
10231032
});
@@ -1632,6 +1641,14 @@ var edgeShim = {
16321641
}
16331642

16341643
localCapabilities = RTCRtpReceiver.getCapabilities(kind);
1644+
1645+
// filter RTX until additional stuff needed for RTX is implemented
1646+
// in adapter.js
1647+
localCapabilities.codecs = localCapabilities.codecs.filter(
1648+
function(codec) {
1649+
return codec.name !== 'rtx';
1650+
});
1651+
16351652
sendEncodingParameters = [{
16361653
ssrc: (2 * sdpMLineIndex + 2) * 1001
16371654
}];
@@ -1941,6 +1958,13 @@ var edgeShim = {
19411958
} : self._createIceAndDtlsTransports(mid, sdpMLineIndex);
19421959

19431960
var localCapabilities = RTCRtpSender.getCapabilities(kind);
1961+
// filter RTX until additional stuff needed for RTX is implemented
1962+
// in adapter.js
1963+
localCapabilities.codecs = localCapabilities.codecs.filter(
1964+
function(codec) {
1965+
return codec.name !== 'rtx';
1966+
});
1967+
19441968
var rtpSender;
19451969
var rtpReceiver;
19461970

@@ -2438,7 +2462,18 @@ module.exports = function() {
24382462
var origGetUserMedia = navigator.mediaDevices.getUserMedia.
24392463
bind(navigator.mediaDevices);
24402464
navigator.mediaDevices.getUserMedia = function(c) {
2441-
return origGetUserMedia(c).catch(function(e) {
2465+
return origGetUserMedia(c).then(function(stream) {
2466+
// Work around https://bugzil.la/802326
2467+
if (c.audio && !stream.getAudioTracks().length ||
2468+
c.video && !stream.getVideoTracks().length) {
2469+
stream.getTracks().forEach(function(track) {
2470+
track.stop();
2471+
});
2472+
throw new DOMException('The object can not be found here.',
2473+
'NotFoundError');
2474+
}
2475+
return stream;
2476+
}, function(e) {
24422477
return Promise.reject(shimError_(e));
24432478
});
24442479
};

release/adapter_no_edge.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,16 @@ module.exports = function() {
526526
bind(navigator.mediaDevices);
527527
navigator.mediaDevices.getUserMedia = function(cs) {
528528
return shimConstraints_(cs, function(c) {
529-
return origGetUserMedia(c).catch(function(e) {
529+
return origGetUserMedia(c).then(function(stream) {
530+
if (c.audio && !stream.getAudioTracks().length ||
531+
c.video && !stream.getVideoTracks().length) {
532+
stream.getTracks().forEach(function(track) {
533+
track.stop();
534+
});
535+
throw new DOMException('', 'NotFoundError');
536+
}
537+
return stream;
538+
}, function(e) {
530539
return Promise.reject(shimError_(e));
531540
});
532541
});
@@ -840,7 +849,18 @@ module.exports = function() {
840849
var origGetUserMedia = navigator.mediaDevices.getUserMedia.
841850
bind(navigator.mediaDevices);
842851
navigator.mediaDevices.getUserMedia = function(c) {
843-
return origGetUserMedia(c).catch(function(e) {
852+
return origGetUserMedia(c).then(function(stream) {
853+
// Work around https://bugzil.la/802326
854+
if (c.audio && !stream.getAudioTracks().length ||
855+
c.video && !stream.getVideoTracks().length) {
856+
stream.getTracks().forEach(function(track) {
857+
track.stop();
858+
});
859+
throw new DOMException('The object can not be found here.',
860+
'NotFoundError');
861+
}
862+
return stream;
863+
}, function(e) {
844864
return Promise.reject(shimError_(e));
845865
});
846866
};

release/adapter_no_edge_no_global.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,16 @@ module.exports = function() {
526526
bind(navigator.mediaDevices);
527527
navigator.mediaDevices.getUserMedia = function(cs) {
528528
return shimConstraints_(cs, function(c) {
529-
return origGetUserMedia(c).catch(function(e) {
529+
return origGetUserMedia(c).then(function(stream) {
530+
if (c.audio && !stream.getAudioTracks().length ||
531+
c.video && !stream.getVideoTracks().length) {
532+
stream.getTracks().forEach(function(track) {
533+
track.stop();
534+
});
535+
throw new DOMException('', 'NotFoundError');
536+
}
537+
return stream;
538+
}, function(e) {
530539
return Promise.reject(shimError_(e));
531540
});
532541
});
@@ -840,7 +849,18 @@ module.exports = function() {
840849
var origGetUserMedia = navigator.mediaDevices.getUserMedia.
841850
bind(navigator.mediaDevices);
842851
navigator.mediaDevices.getUserMedia = function(c) {
843-
return origGetUserMedia(c).catch(function(e) {
852+
return origGetUserMedia(c).then(function(stream) {
853+
// Work around https://bugzil.la/802326
854+
if (c.audio && !stream.getAudioTracks().length ||
855+
c.video && !stream.getVideoTracks().length) {
856+
stream.getTracks().forEach(function(track) {
857+
track.stop();
858+
});
859+
throw new DOMException('The object can not be found here.',
860+
'NotFoundError');
861+
}
862+
return stream;
863+
}, function(e) {
844864
return Promise.reject(shimError_(e));
845865
});
846866
};

release/adapter_no_global.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,16 @@ module.exports = function() {
10171017
bind(navigator.mediaDevices);
10181018
navigator.mediaDevices.getUserMedia = function(cs) {
10191019
return shimConstraints_(cs, function(c) {
1020-
return origGetUserMedia(c).catch(function(e) {
1020+
return origGetUserMedia(c).then(function(stream) {
1021+
if (c.audio && !stream.getAudioTracks().length ||
1022+
c.video && !stream.getVideoTracks().length) {
1023+
stream.getTracks().forEach(function(track) {
1024+
track.stop();
1025+
});
1026+
throw new DOMException('', 'NotFoundError');
1027+
}
1028+
return stream;
1029+
}, function(e) {
10211030
return Promise.reject(shimError_(e));
10221031
});
10231032
});
@@ -1632,6 +1641,14 @@ var edgeShim = {
16321641
}
16331642

16341643
localCapabilities = RTCRtpReceiver.getCapabilities(kind);
1644+
1645+
// filter RTX until additional stuff needed for RTX is implemented
1646+
// in adapter.js
1647+
localCapabilities.codecs = localCapabilities.codecs.filter(
1648+
function(codec) {
1649+
return codec.name !== 'rtx';
1650+
});
1651+
16351652
sendEncodingParameters = [{
16361653
ssrc: (2 * sdpMLineIndex + 2) * 1001
16371654
}];
@@ -1941,6 +1958,13 @@ var edgeShim = {
19411958
} : self._createIceAndDtlsTransports(mid, sdpMLineIndex);
19421959

19431960
var localCapabilities = RTCRtpSender.getCapabilities(kind);
1961+
// filter RTX until additional stuff needed for RTX is implemented
1962+
// in adapter.js
1963+
localCapabilities.codecs = localCapabilities.codecs.filter(
1964+
function(codec) {
1965+
return codec.name !== 'rtx';
1966+
});
1967+
19441968
var rtpSender;
19451969
var rtpReceiver;
19461970

@@ -2438,7 +2462,18 @@ module.exports = function() {
24382462
var origGetUserMedia = navigator.mediaDevices.getUserMedia.
24392463
bind(navigator.mediaDevices);
24402464
navigator.mediaDevices.getUserMedia = function(c) {
2441-
return origGetUserMedia(c).catch(function(e) {
2465+
return origGetUserMedia(c).then(function(stream) {
2466+
// Work around https://bugzil.la/802326
2467+
if (c.audio && !stream.getAudioTracks().length ||
2468+
c.video && !stream.getVideoTracks().length) {
2469+
stream.getTracks().forEach(function(track) {
2470+
track.stop();
2471+
});
2472+
throw new DOMException('The object can not be found here.',
2473+
'NotFoundError');
2474+
}
2475+
return stream;
2476+
}, function(e) {
24422477
return Promise.reject(shimError_(e));
24432478
});
24442479
};

0 commit comments

Comments
 (0)