|
@@ -311,8 +311,8 @@ function getConstraints(um, options) {
|
311
|
311
|
* @param stream the stream we received from calling getUserMedia.
|
312
|
312
|
*/
|
313
|
313
|
function setAvailableDevices(um, stream) {
|
314
|
|
- const audioTracksReceived = stream && !!stream.getAudioTracks().length;
|
315
|
|
- const videoTracksReceived = stream && !!stream.getVideoTracks().length;
|
|
314
|
+ const audioTracksReceived = stream && stream.getAudioTracks().length > 0;
|
|
315
|
+ const videoTracksReceived = stream && stream.getVideoTracks().length > 0;
|
316
|
316
|
|
317
|
317
|
if (um.indexOf('video') != -1) {
|
318
|
318
|
devices.video = videoTracksReceived;
|
|
@@ -868,7 +868,7 @@ class RTCUtils extends Listenable {
|
868
|
868
|
&& !containerSel.is(':visible')) {
|
869
|
869
|
containerSel.show();
|
870
|
870
|
}
|
871
|
|
- const video = !!stream.getVideoTracks().length;
|
|
871
|
+ const video = stream.getVideoTracks().length > 0;
|
872
|
872
|
if (video && !$(element).is(':visible')) {
|
873
|
873
|
throw new Error(
|
874
|
874
|
'video element must be visible to attach'
|
|
@@ -1044,10 +1044,14 @@ class RTCUtils extends Listenable {
|
1044
|
1044
|
this.getUserMediaWithConstraints(
|
1045
|
1045
|
options.devices,
|
1046
|
1046
|
function(stream) {
|
1047
|
|
- const audioDeviceRequested = options.devices.indexOf('audio') !== -1;
|
1048
|
|
- const videoDeviceRequested = options.devices.indexOf('video') !== -1;
|
1049
|
|
- const audioTracksReceived = !!stream.getAudioTracks().length;
|
1050
|
|
- const videoTracksReceived = !!stream.getVideoTracks().length;
|
|
1047
|
+ const audioDeviceRequested
|
|
1048
|
+ = options.devices.indexOf('audio') !== -1;
|
|
1049
|
+ const videoDeviceRequested
|
|
1050
|
+ = options.devices.indexOf('video') !== -1;
|
|
1051
|
+ const audioTracksReceived
|
|
1052
|
+ = stream.getAudioTracks().length > 0;
|
|
1053
|
+ const videoTracksReceived
|
|
1054
|
+ = stream.getVideoTracks().length > 0;
|
1051
|
1055
|
|
1052
|
1056
|
if((audioDeviceRequested && !audioTracksReceived)
|
1053
|
1057
|
|| (videoDeviceRequested && !videoTracksReceived)) {
|
|
@@ -1143,11 +1147,10 @@ class RTCUtils extends Listenable {
|
1143
|
1147
|
if (!rtcReady) {
|
1144
|
1148
|
throw new Error('WebRTC not ready yet');
|
1145
|
1149
|
}
|
1146
|
|
- return !!(
|
1147
|
|
- navigator.mediaDevices
|
1148
|
|
- && navigator.mediaDevices.enumerateDevices
|
1149
|
|
- && typeof MediaStreamTrack !== 'undefined'
|
1150
|
|
- && MediaStreamTrack.getSources);
|
|
1150
|
+ return Boolean(navigator.mediaDevices
|
|
1151
|
+ && navigator.mediaDevices.enumerateDevices
|
|
1152
|
+ && typeof MediaStreamTrack !== 'undefined'
|
|
1153
|
+ && MediaStreamTrack.getSources);
|
1151
|
1154
|
}
|
1152
|
1155
|
|
1153
|
1156
|
/**
|