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 {
|
import {
|
||||||
areDeviceLabelsInitialized,
|
areDeviceLabelsInitialized,
|
||||||
getDeviceIdByLabel,
|
getDeviceIdByLabel,
|
||||||
getDevicesFromURL
|
getDevicesFromURL,
|
||||||
|
setAudioOutputDeviceId
|
||||||
} from './functions';
|
} from './functions';
|
||||||
|
|
||||||
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a pending device request.
|
* Adds a pending device request.
|
||||||
*
|
*
|
||||||
|
@ -36,11 +39,12 @@ export function addPendingDeviceRequest(request) {
|
||||||
* @returns {Function}
|
* @returns {Function}
|
||||||
*/
|
*/
|
||||||
export function configureInitialDevices() {
|
export function configureInitialDevices() {
|
||||||
return (dispatch, getState) => new Promise(resolve => {
|
return (dispatch, getState) => {
|
||||||
const deviceLabels = getDevicesFromURL(getState());
|
const deviceLabels = getDevicesFromURL(getState());
|
||||||
|
let updateSettingsPromise;
|
||||||
|
|
||||||
if (deviceLabels) {
|
if (deviceLabels) {
|
||||||
dispatch(getAvailableDevices()).then(() => {
|
updateSettingsPromise = dispatch(getAvailableDevices()).then(() => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
||||||
if (!areDeviceLabelsInitialized(state)) {
|
if (!areDeviceLabelsInitialized(state)) {
|
||||||
|
@ -59,7 +63,6 @@ export function configureInitialDevices() {
|
||||||
responseCallback() {}
|
responseCallback() {}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
resolve();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,13 +83,21 @@ export function configureInitialDevices() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(updateSettings(newSettings));
|
dispatch(updateSettings(newSettings));
|
||||||
resolve();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} 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 _ from 'lodash';
|
||||||
|
|
||||||
import { APP_WILL_MOUNT } from '../app';
|
import { APP_WILL_MOUNT } from '../app';
|
||||||
import JitsiMeetJS, { browser } from '../lib-jitsi-meet';
|
import { browser } from '../lib-jitsi-meet';
|
||||||
import { ReducerRegistry } from '../redux';
|
import { ReducerRegistry } from '../redux';
|
||||||
import { PersistenceRegistry } from '../storage';
|
import { PersistenceRegistry } from '../storage';
|
||||||
import { assignIfDefined } from '../util';
|
import { assignIfDefined } from '../util';
|
||||||
|
@ -136,17 +136,6 @@ function _initSettings(featureState) {
|
||||||
localFlipX,
|
localFlipX,
|
||||||
micDeviceId
|
micDeviceId
|
||||||
}, settings);
|
}, 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
|
// Things we stored in profile earlier
|
||||||
|
|
Loading…
Reference in New Issue