2019-10-18 14:30:59 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
export * from './functions.any';
|
|
|
|
|
2020-03-30 14:17:18 +00:00
|
|
|
/**
|
|
|
|
* Returns the deviceId for the currently used camera.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the application.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function getCurrentCameraDeviceId(state: Object) {
|
2020-06-19 07:03:26 +00:00
|
|
|
return getDeviceIdByType(state, 'isVideoTrack');
|
2020-03-30 14:17:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the deviceId for the currently used microphone.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the application.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function getCurrentMicDeviceId(state: Object) {
|
2020-06-19 07:03:26 +00:00
|
|
|
return getDeviceIdByType(state, 'isAudioTrack');
|
2020-03-30 14:17:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the deviceId for the currently used speaker.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the application.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function getCurrentOutputDeviceId(state: Object) {
|
|
|
|
return state['features/base/settings'].audioOutputDeviceId;
|
|
|
|
}
|
|
|
|
|
2020-06-19 07:03:26 +00:00
|
|
|
/**
|
|
|
|
* Returns the deviceId for the corresponding local track type.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the application.
|
|
|
|
* @param {string} isType - Can be 'isVideoTrack' | 'isAudioTrack'.
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
function getDeviceIdByType(state: Object, isType: string) {
|
|
|
|
const [ deviceId ] = state['features/base/tracks']
|
|
|
|
.map(t => t.jitsiTrack)
|
|
|
|
.filter(t => t && t.isLocal() && t[isType]())
|
|
|
|
.map(t => t.getDeviceId());
|
|
|
|
|
|
|
|
return deviceId || '';
|
|
|
|
}
|
|
|
|
|
2020-05-07 07:42:55 +00:00
|
|
|
/**
|
|
|
|
* Returns the saved display name.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The state of the application.
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
export function getDisplayName(state: Object): string {
|
|
|
|
return state['features/base/settings'].displayName || '';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-18 14:30:59 +00:00
|
|
|
/**
|
|
|
|
* Handles changes to the `disableCallIntegration` setting.
|
|
|
|
* Noop on web.
|
|
|
|
*
|
|
|
|
* @param {boolean} disabled - Whether call integration is disabled or not.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function handleCallIntegrationChange(disabled: boolean) { // eslint-disable-line no-unused-vars
|
|
|
|
}
|
2020-05-07 21:05:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles changes to the `disableCrashReporting` setting.
|
|
|
|
* Noop on web.
|
|
|
|
*
|
|
|
|
* @param {boolean} disabled - Whether crash reporting is disabled or not.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function handleCrashReportingChange(disabled: boolean) { // eslint-disable-line no-unused-vars
|
|
|
|
}
|