2022-09-14 07:54:56 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../app/types';
|
2019-10-18 14:30:59 +00:00
|
|
|
|
|
|
|
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}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getCurrentCameraDeviceId(state: IReduxState) {
|
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}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getCurrentMicDeviceId(state: IReduxState) {
|
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}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getCurrentOutputDeviceId(state: IReduxState) {
|
2020-03-30 14:17:18 +00:00
|
|
|
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}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
function getDeviceIdByType(state: IReduxState, isType: string) {
|
2020-06-19 07:03:26 +00:00
|
|
|
const [ deviceId ] = state['features/base/tracks']
|
2022-09-14 07:54:56 +00:00
|
|
|
.map(t => t.jitsiTrack)
|
|
|
|
.filter(t => t?.isLocal() && t[isType as keyof typeof t]())
|
|
|
|
.map(t => t.getDeviceId());
|
2020-06-19 07:03:26 +00:00
|
|
|
|
|
|
|
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}
|
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
export function getDisplayName(state: IReduxState): string {
|
2020-05-07 07:42:55 +00:00
|
|
|
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}
|
|
|
|
*/
|
2022-09-14 07:54:56 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-function, require-jsdoc
|
|
|
|
export function handleCallIntegrationChange(disabled: boolean) { }
|
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}
|
|
|
|
*/
|
2022-09-14 07:54:56 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-function, require-jsdoc
|
|
|
|
export function handleCrashReportingChange(disabled: boolean) { }
|