ref(conference): use options in init tracks

This commit is contained in:
paweldomas 2017-07-18 12:25:37 +02:00
parent 117d3bb110
commit 3fbb022ffb
1 changed files with 8 additions and 6 deletions

View File

@ -493,11 +493,12 @@ export default {
* show guidance overlay for users on how to give access to camera and/or * show guidance overlay for users on how to give access to camera and/or
* microphone, * microphone,
* @param {string} roomName * @param {string} roomName
* @param {boolean} startScreenSharing - if <tt>true</tt> should start with * @param {object} options
* screensharing instead of camera video. * @param {boolean} options.startScreenSharing - if <tt>true</tt> should
* start with screensharing instead of camera video.
* @returns {Promise.<JitsiLocalTrack[], JitsiConnection>} * @returns {Promise.<JitsiLocalTrack[], JitsiConnection>}
*/ */
createInitialLocalTracksAndConnect(roomName, startScreenSharing) { createInitialLocalTracksAndConnect(roomName, options = {}) {
let audioAndVideoError, let audioAndVideoError,
audioOnlyError, audioOnlyError,
screenSharingError, screenSharingError,
@ -514,7 +515,7 @@ export default {
let tryCreateLocalTracks; let tryCreateLocalTracks;
// FIXME the logic about trying to go audio only on error is duplicated // FIXME the logic about trying to go audio only on error is duplicated
if (startScreenSharing) { if (options.startScreenSharing) {
tryCreateLocalTracks = this._createDesktopTrack() tryCreateLocalTracks = this._createDesktopTrack()
.then(desktopStream => { .then(desktopStream => {
return createLocalTracks({ devices: ['audio'] }, true) return createLocalTracks({ devices: ['audio'] }, true)
@ -621,8 +622,9 @@ export default {
).then(() => { ).then(() => {
analytics.init(); analytics.init();
return this.createInitialLocalTracksAndConnect( return this.createInitialLocalTracksAndConnect(
options.roomName, options.roomName, {
config.startScreenSharing); startScreenSharing: config.startScreenSharing
});
}).then(([tracks, con]) => { }).then(([tracks, con]) => {
tracks.forEach(track => { tracks.forEach(track => {
if((track.isAudioTrack() && initialAudioMutedState) if((track.isAudioTrack() && initialAudioMutedState)