From ee3f82bf0ce29cc09851f7a9d3d414b6d6cd4827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 14 Apr 2025 15:49:27 +0200 Subject: [PATCH] feat(external_api,devices) drop use of isDeviceListAvailable It's always true. --- conference.js | 3 +-- modules/API/external/external_api.js | 8 ++++++-- modules/API/external/functions.js | 15 --------------- react/features/base/devices/actions.web.ts | 3 +-- react/features/device-selection/functions.web.ts | 3 ++- 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/conference.js b/conference.js index 753ff41a80..363427d3fd 100644 --- a/conference.js +++ b/conference.js @@ -2069,8 +2069,7 @@ export default { _initDeviceList(setDeviceListChangeHandler = false) { const { mediaDevices } = JitsiMeetJS; - if (mediaDevices.isDeviceListAvailable() - && mediaDevices.isDeviceChangeAvailable()) { + if (mediaDevices.isDeviceChangeAvailable()) { if (setDeviceListChangeHandler) { this.deviceChangeListener = devices => window.setTimeout(() => this._onDeviceListChanged(devices), 0); diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 873f65df6f..e3fd117465 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -11,7 +11,6 @@ import { getAvailableDevices, getCurrentDevices, isDeviceChangeAvailable, - isDeviceListAvailable, isMultipleAudioInputSupported, setAudioInputDevice, setAudioOutputDevice, @@ -989,10 +988,15 @@ export default class JitsiMeetExternalAPI extends EventEmitter { * Returns Promise that resolves with true if the device list is available * and with false if not. * + * @deprecated + * * @returns {Promise} */ isDeviceListAvailable() { - return isDeviceListAvailable(this._transport); + console.warn('isDeviceListAvailable is deprecated and will be removed in the future. ' + + 'It always returns true'); + + return Promise.resolve(true); } /** diff --git a/modules/API/external/functions.js b/modules/API/external/functions.js index d0cc474f87..f1de18ce14 100644 --- a/modules/API/external/functions.js +++ b/modules/API/external/functions.js @@ -56,21 +56,6 @@ export function isDeviceChangeAvailable(transport, deviceType) { }); } -/** - * Returns Promise that resolves with true if the device list is available - * and with false if not. - * - * @param {Transport} transport - The @code{Transport} instance responsible for - * the external communication. - * @returns {Promise} - */ -export function isDeviceListAvailable(transport) { - return transport.sendRequest({ - type: 'devices', - name: 'isDeviceListAvailable' - }); -} - /** * Returns Promise that resolves with true if multiple audio input is supported * and with false if not. diff --git a/react/features/base/devices/actions.web.ts b/react/features/base/devices/actions.web.ts index 14b219dc8e..ab1f9080d9 100644 --- a/react/features/base/devices/actions.web.ts +++ b/react/features/base/devices/actions.web.ts @@ -150,8 +150,7 @@ export function getAvailableDevices() { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => new Promise(resolve => { const { mediaDevices } = JitsiMeetJS; - if (mediaDevices.isDeviceListAvailable() - && mediaDevices.isDeviceChangeAvailable()) { + if (mediaDevices.isDeviceChangeAvailable()) { mediaDevices.enumerateDevices((devices: MediaDeviceInfo[]) => { const { filteredDevices, ignoredDevices } = filterIgnoredDevices(devices); const oldDevices = flattenAvailableDevices(getState()['features/base/devices'].availableDevices); diff --git a/react/features/device-selection/functions.web.ts b/react/features/device-selection/functions.web.ts index 76f5b2a25b..725a58817c 100644 --- a/react/features/device-selection/functions.web.ts +++ b/react/features/device-selection/functions.web.ts @@ -163,7 +163,8 @@ export function processExternalDeviceRequest( // eslint-disable-line max-params switch (request.name) { case 'isDeviceListAvailable': - responseCallback(JitsiMeetJS.mediaDevices.isDeviceListAvailable()); + // TODO(saghul): remove this, eventually. + responseCallback(true); break; case 'isDeviceChangeAvailable': responseCallback(