fix(device-selection): set audio output device on initial configuration
When the iFrame api is used to set a preferred audio output using options passed into the JitsiMeetExternalAPI constructor, no logic fires to actually change the audio output destination.
This commit is contained in:
parent
b731459ea4
commit
ec09085a50
|
@ -11,9 +11,12 @@ import {
|
|||
import {
|
||||
areDeviceLabelsInitialized,
|
||||
getDeviceIdByLabel,
|
||||
getDevicesFromURL
|
||||
getDevicesFromURL,
|
||||
setAudioOutputDeviceId
|
||||
} from './functions';
|
||||
|
||||
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
||||
|
||||
/**
|
||||
* Adds a pending device request.
|
||||
*
|
||||
|
@ -36,11 +39,12 @@ export function addPendingDeviceRequest(request) {
|
|||
* @returns {Function}
|
||||
*/
|
||||
export function configureInitialDevices() {
|
||||
return (dispatch, getState) => new Promise(resolve => {
|
||||
return (dispatch, getState) => {
|
||||
const deviceLabels = getDevicesFromURL(getState());
|
||||
let updateSettingsPromise;
|
||||
|
||||
if (deviceLabels) {
|
||||
dispatch(getAvailableDevices()).then(() => {
|
||||
updateSettingsPromise = dispatch(getAvailableDevices()).then(() => {
|
||||
const state = getState();
|
||||
|
||||
if (!areDeviceLabelsInitialized(state)) {
|
||||
|
@ -59,7 +63,6 @@ export function configureInitialDevices() {
|
|||
responseCallback() {}
|
||||
}));
|
||||
});
|
||||
resolve();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -80,13 +83,21 @@ export function configureInitialDevices() {
|
|||
});
|
||||
|
||||
dispatch(updateSettings(newSettings));
|
||||
resolve();
|
||||
});
|
||||
|
||||
} else {
|
||||
resolve();
|
||||
updateSettingsPromise = Promise.resolve();
|
||||
}
|
||||
});
|
||||
|
||||
return updateSettingsPromise
|
||||
.then(() => {
|
||||
const { audioOutputDeviceId }
|
||||
= getState()['features/base/settings'];
|
||||
|
||||
return setAudioOutputDeviceId(audioOutputDeviceId, dispatch)
|
||||
.catch(ex => logger.warn(`Failed to set audio output device.
|
||||
Default audio output device will be used instead ${ex}`));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@ import { randomHexString } from 'js-utils/random';
|
|||
import _ from 'lodash';
|
||||
|
||||
import { APP_WILL_MOUNT } from '../app';
|
||||
import JitsiMeetJS, { browser } from '../lib-jitsi-meet';
|
||||
import { browser } from '../lib-jitsi-meet';
|
||||
import { ReducerRegistry } from '../redux';
|
||||
import { PersistenceRegistry } from '../storage';
|
||||
import { assignIfDefined } from '../util';
|
||||
|
@ -136,17 +136,6 @@ function _initSettings(featureState) {
|
|||
localFlipX,
|
||||
micDeviceId
|
||||
}, settings);
|
||||
|
||||
if (settings.audioOutputDeviceId
|
||||
!== JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
|
||||
JitsiMeetJS.mediaDevices.setAudioOutputDevice(
|
||||
settings.audioOutputDeviceId
|
||||
).catch(ex => {
|
||||
logger.warn('Failed to set audio output device from local '
|
||||
+ 'storage. Default audio output device will be used'
|
||||
+ 'instead.', ex);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Things we stored in profile earlier
|
||||
|
|
Loading…
Reference in New Issue