Skip to content

Commit 0cc53b8

Browse files
committed
per-finish
1 parent 694bc22 commit 0cc53b8

File tree

2 files changed

+28
-37
lines changed

2 files changed

+28
-37
lines changed

js/modules/webrtc/qbWebRTCClient.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,31 +74,6 @@ WebRTCClient.prototype.getMediaDevices = function(spec) {
7474
});
7575
};
7676

77-
// WebRTCClient.getOutputDevices = function(callback) {
78-
//
79-
// return new Promise(function() {
80-
//
81-
// devices.forEach(function(device, i) {
82-
// if(device.kind === 'videoinput') {
83-
// /** If user don't share device, device.label will be empty */
84-
// if(device.label === '') {
85-
// device.name = 'Camera #' + index;
86-
// ++index;
87-
// }
88-
// avaibleDevices.push(device);
89-
// }
90-
// });
91-
//
92-
// callback(avaibleDevices, null);
93-
// })
94-
// .catch(function(error) {
95-
// Helpers.traceError(error.name + ": " + error.message);
96-
//
97-
// callback(null, err);
98-
// });
99-
// });
100-
// };
101-
10277
/**
10378
* A map with all sessions the user had/have.
10479
* @type {Object.<string, Object>}

samples/webrtc/js/app.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
app.router.navigate(path, {'trigger': true});
4343
},
4444
'join': function() {
45+
/** Before use WebRTC checking WebRTC is avaible */
46+
if (!QB.webrtc) {
47+
alert('Error: ' + CONFIG.MESSAGES.webrtc_not_avaible);
48+
return;
49+
}
50+
4551
this.container
4652
.removeClass('page-dashboard')
4753
.addClass('page-join');
@@ -53,6 +59,8 @@
5359
app.calleesAnwered = [];
5460
app.users = [];
5561
app.videoMain = 0;
62+
63+
5664
},
5765
'dashboard': function() {
5866
if (_.isEmpty(app.caller)) {
@@ -69,17 +77,6 @@
6977
/** render skelet */
7078
$('.j-dashboard').append( $('#dashboard_tpl').html() );
7179

72-
/** Before use WebRTC checking WebRTC is avaible */
73-
if (!QB.webrtc) {
74-
app.helpers.stateBoard = new app.helpers.StateBoard('.j-state_board', {
75-
title: 'webrtc_not_avaible',
76-
isError: 'qb-error'
77-
});
78-
79-
alert('Error: ' + CONFIG.MESSAGES.webrtc_not_avaible);
80-
return;
81-
}
82-
8380
/** render stateBoard */
8481
app.helpers.stateBoard = new app.helpers.StateBoard('.j-state_board', {
8582
title: 'tpl_default',
@@ -115,6 +112,18 @@
115112
if(devices.length > 1) {
116113
var $select = $('.j-source');
117114

115+
for (var i = 0; i !== devices.length; ++i) {
116+
var deviceInfo = devices[i],
117+
option = document.createElement('option');
118+
119+
option.value = deviceInfo.deviceId;
120+
121+
if (deviceInfo.kind === 'videoinput') {
122+
option.text = deviceInfo.label || 'Camera ' + (i + 1);
123+
$select.append(option);
124+
}
125+
}
126+
118127
$select.removeClass('invisible');
119128
}
120129
}).catch(function(error) {
@@ -226,10 +235,15 @@
226235
/** Call / End of call */
227236
$(document).on('click', '.j-actions', function() {
228237
var $btn = $(this),
238+
$videoSourceFilter = $(ui.sourceFilter),
229239
videoElems = '',
230240
mediaParams = {
231241
audio: true,
232-
video: true,
242+
video: {
243+
optional: [
244+
{sourceId: $videoSourceFilter.val() ? $videoSourceFilter.val() : undefined}
245+
]
246+
},
233247
options: {
234248
muted: true,
235249
mirror: true
@@ -302,6 +316,7 @@
302316

303317
$('.j-callees').append(videoElems);
304318

319+
$videoSourceFilter.attr('disabled', true);
305320
$btn.addClass('hangup');
306321
app.helpers.setFooterPosition();
307322
}
@@ -522,6 +537,7 @@
522537

523538
$('.j-actions').removeClass('hangup');
524539
$('.j-caller__ctrl').removeClass('active');
540+
$(ui.sourceFilter).attr('disabled', false);
525541
$('.j-callees').empty();
526542

527543
app.currentSession.detachMediaStream('main_video');

0 commit comments

Comments
 (0)