fix(settings_buttons): Persist audio/video settings across sessions.
This commit is contained in:
parent
f9fcb46036
commit
b50d6e43d0
|
@ -17,6 +17,7 @@ import {
|
|||
import {
|
||||
areDeviceLabelsInitialized,
|
||||
getDeviceIdByLabel,
|
||||
getDeviceLabelById,
|
||||
getDevicesFromURL,
|
||||
setAudioOutputDeviceId
|
||||
} from './functions';
|
||||
|
@ -216,6 +217,25 @@ export function setAudioInputDevice(deviceId) {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the audio input device id and updates the settings
|
||||
* so they are persisted across sessions.
|
||||
*
|
||||
* @param {string} deviceId - The id of the new audio input device.
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function setAudioInputDeviceAndUpdateSettings(deviceId) {
|
||||
return function(dispatch, getState) {
|
||||
const deviceLabel = getDeviceLabelById(getState(), deviceId, 'audioInput');
|
||||
|
||||
dispatch(setAudioInputDevice(deviceId));
|
||||
dispatch(updateSettings({
|
||||
userSelectedMicDeviceId: deviceId,
|
||||
userSelectedMicDeviceLabel: deviceLabel
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the output device id.
|
||||
*
|
||||
|
@ -244,6 +264,25 @@ export function setVideoInputDevice(deviceId) {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the video input device id and updates the settings
|
||||
* so they are persisted across sessions.
|
||||
*
|
||||
* @param {string} deviceId - The id of the new video input device.
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function setVideoInputDeviceAndUpdateSettings(deviceId) {
|
||||
return function(dispatch, getState) {
|
||||
const deviceLabel = getDeviceLabelById(getState(), deviceId, 'videoInput');
|
||||
|
||||
dispatch(setVideoInputDevice(deviceId));
|
||||
dispatch(updateSettings({
|
||||
userSelectedCameraDeviceId: deviceId,
|
||||
userSelectedCameraDeviceLabel: deviceLabel
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals to update the list of known audio and video devices.
|
||||
*
|
||||
|
|
|
@ -8,7 +8,7 @@ import { toggleAudioSettings } from '../../../actions';
|
|||
import {
|
||||
getAudioInputDeviceData,
|
||||
getAudioOutputDeviceData,
|
||||
setAudioInputDevice as setAudioInputDeviceAction,
|
||||
setAudioInputDeviceAndUpdateSettings,
|
||||
setAudioOutputDevice as setAudioOutputDeviceAction
|
||||
} from '../../../../base/devices';
|
||||
import { connect } from '../../../../base/redux';
|
||||
|
@ -90,7 +90,7 @@ function mapStateToProps(state) {
|
|||
|
||||
const mapDispatchToProps = {
|
||||
onClose: toggleAudioSettings,
|
||||
setAudioInputDevice: setAudioInputDeviceAction,
|
||||
setAudioInputDevice: setAudioInputDeviceAndUpdateSettings,
|
||||
setAudioOutputDevice: setAudioOutputDeviceAction
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import InlineDialog from '@atlaskit/inline-dialog';
|
|||
import { toggleVideoSettings } from '../../../actions';
|
||||
import {
|
||||
getVideoDeviceIds,
|
||||
setVideoInputDevice as setVideoInputDeviceAction
|
||||
setVideoInputDeviceAndUpdateSettings
|
||||
} from '../../../../base/devices';
|
||||
import { getVideoSettingsVisibility } from '../../../functions';
|
||||
import { connect } from '../../../../base/redux';
|
||||
|
@ -79,7 +79,7 @@ function mapStateToProps(state) {
|
|||
|
||||
const mapDispatchToProps = {
|
||||
onClose: toggleVideoSettings,
|
||||
setVideoInputDevice: setVideoInputDeviceAction
|
||||
setVideoInputDevice: setVideoInputDeviceAndUpdateSettings
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(VideoSettingsPopup);
|
||||
|
|
Loading…
Reference in New Issue