fix(settings_buttons): Persist audio/video settings across sessions.
This commit is contained in:
parent
f9fcb46036
commit
b50d6e43d0
|
@ -17,6 +17,7 @@ import {
|
||||||
import {
|
import {
|
||||||
areDeviceLabelsInitialized,
|
areDeviceLabelsInitialized,
|
||||||
getDeviceIdByLabel,
|
getDeviceIdByLabel,
|
||||||
|
getDeviceLabelById,
|
||||||
getDevicesFromURL,
|
getDevicesFromURL,
|
||||||
setAudioOutputDeviceId
|
setAudioOutputDeviceId
|
||||||
} from './functions';
|
} 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.
|
* 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.
|
* Signals to update the list of known audio and video devices.
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { toggleAudioSettings } from '../../../actions';
|
||||||
import {
|
import {
|
||||||
getAudioInputDeviceData,
|
getAudioInputDeviceData,
|
||||||
getAudioOutputDeviceData,
|
getAudioOutputDeviceData,
|
||||||
setAudioInputDevice as setAudioInputDeviceAction,
|
setAudioInputDeviceAndUpdateSettings,
|
||||||
setAudioOutputDevice as setAudioOutputDeviceAction
|
setAudioOutputDevice as setAudioOutputDeviceAction
|
||||||
} from '../../../../base/devices';
|
} from '../../../../base/devices';
|
||||||
import { connect } from '../../../../base/redux';
|
import { connect } from '../../../../base/redux';
|
||||||
|
@ -90,7 +90,7 @@ function mapStateToProps(state) {
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
onClose: toggleAudioSettings,
|
onClose: toggleAudioSettings,
|
||||||
setAudioInputDevice: setAudioInputDeviceAction,
|
setAudioInputDevice: setAudioInputDeviceAndUpdateSettings,
|
||||||
setAudioOutputDevice: setAudioOutputDeviceAction
|
setAudioOutputDevice: setAudioOutputDeviceAction
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import InlineDialog from '@atlaskit/inline-dialog';
|
||||||
import { toggleVideoSettings } from '../../../actions';
|
import { toggleVideoSettings } from '../../../actions';
|
||||||
import {
|
import {
|
||||||
getVideoDeviceIds,
|
getVideoDeviceIds,
|
||||||
setVideoInputDevice as setVideoInputDeviceAction
|
setVideoInputDeviceAndUpdateSettings
|
||||||
} from '../../../../base/devices';
|
} from '../../../../base/devices';
|
||||||
import { getVideoSettingsVisibility } from '../../../functions';
|
import { getVideoSettingsVisibility } from '../../../functions';
|
||||||
import { connect } from '../../../../base/redux';
|
import { connect } from '../../../../base/redux';
|
||||||
|
@ -79,7 +79,7 @@ function mapStateToProps(state) {
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
onClose: toggleVideoSettings,
|
onClose: toggleVideoSettings,
|
||||||
setVideoInputDevice: setVideoInputDeviceAction
|
setVideoInputDevice: setVideoInputDeviceAndUpdateSettings
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(VideoSettingsPopup);
|
export default connect(mapStateToProps, mapDispatchToProps)(VideoSettingsPopup);
|
||||||
|
|
Loading…
Reference in New Issue