|
|
@@ -11,11 +11,17 @@ var DesktopSharingEventTypes
|
|
11
|
11
|
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
|
|
12
|
12
|
var RTCEvents = require("../../service/RTC/RTCEvents.js");
|
|
13
|
13
|
|
|
14
|
|
-function createLocalTracks(streams) {
|
|
|
14
|
+function createLocalTracks(streams, options) {
|
|
15
|
15
|
var newStreams = []
|
|
|
16
|
+ var deviceId = null;
|
|
16
|
17
|
for (var i = 0; i < streams.length; i++) {
|
|
|
18
|
+ if (streams[i].type === 'audio') {
|
|
|
19
|
+ deviceId = options.micDeviceId;
|
|
|
20
|
+ } else if (streams[i].videoType === 'camera'){
|
|
|
21
|
+ deviceId = options.cameraDeviceId;
|
|
|
22
|
+ }
|
|
17
|
23
|
var localStream = new JitsiLocalTrack(streams[i].stream,
|
|
18
|
|
- streams[i].videoType, streams[i].resolution);
|
|
|
24
|
+ streams[i].videoType, streams[i].resolution, deviceId);
|
|
19
|
25
|
newStreams.push(localStream);
|
|
20
|
26
|
if (streams[i].isMuted === true)
|
|
21
|
27
|
localStream.setMute(true);
|
|
|
@@ -73,8 +79,11 @@ function RTC(room, options) {
|
|
73
|
79
|
* @param {string} options.micDeviceId
|
|
74
|
80
|
* @returns {*} Promise object that will receive the new JitsiTracks
|
|
75
|
81
|
*/
|
|
|
82
|
+
|
|
76
|
83
|
RTC.obtainAudioAndVideoPermissions = function (options) {
|
|
77
|
|
- return RTCUtils.obtainAudioAndVideoPermissions(options).then(createLocalTracks);
|
|
|
84
|
+ return RTCUtils.obtainAudioAndVideoPermissions(options).then(function (streams) {
|
|
|
85
|
+ return createLocalTracks(streams, options);
|
|
|
86
|
+ });
|
|
78
|
87
|
}
|
|
79
|
88
|
|
|
80
|
89
|
RTC.prototype.onIncommingCall = function(event) {
|