init
Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
2025-09-02 14:49:16 +08:00
commit 38ba663466
2885 changed files with 391107 additions and 0 deletions

3
modules/API/.eslintrc.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
'extends': '../../react/.eslintrc.js'
};

2352
modules/API/API.js Executable file

File diff suppressed because it is too large Load Diff

31
modules/API/constants.js Normal file
View File

@@ -0,0 +1,31 @@
// XXX The function parseURLParams is exported by the feature base/util (as
// defined in the terminology of react/). However, this file is (very likely)
// bundled in external_api in addition to app.bundle and, consequently, it is
// best to import as little as possible here (rather than the whole feature
// base/util) in order to minimize the amount of source code bundled into
// multiple bundles.
import { parseURLParams } from '../../react/features/base/util/parseURLParams';
/**
* JitsiMeetExternalAPI id - unique for a webpage.
* TODO: This shouldn't be computed here.
*/
let _apiID;
try {
_apiID = parseURLParams(window.location).jitsi_meet_external_api_id;
} catch (_) { /* Ignore. */ }
export const API_ID = _apiID;
/**
* The payload name for the datachannel/endpoint text message event.
*/
export const ENDPOINT_TEXT_MESSAGE_NAME = 'endpoint-text-message';
/**
* The min value that can be set for the assumed bandwidth.
* Setting it to this value means not assuming any bandwidth,
* but rather allowing the estimations to take place.
*/
export const MIN_ASSUMED_BANDWIDTH_BPS = -1;

1508
modules/API/external/external_api.js vendored Normal file

File diff suppressed because it is too large Load Diff

139
modules/API/external/functions.js vendored Normal file
View File

@@ -0,0 +1,139 @@
import Logger from '@jitsi/logger';
const logger = Logger.getLogger(__filename);
/**
* Returns Promise that resolves with result an list of available devices.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @returns {Promise}
*/
export function getAvailableDevices(transport) {
return transport.sendRequest({
type: 'devices',
name: 'getAvailableDevices'
}).catch(e => {
logger.error(e);
return {};
});
}
/**
* Returns Promise that resolves with current selected devices.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @returns {Promise}
*/
export function getCurrentDevices(transport) {
return transport.sendRequest({
type: 'devices',
name: 'getCurrentDevices'
}).catch(e => {
logger.error(e);
return {};
});
}
/**
* Returns Promise that resolves with true if the device change is available
* and with false if not.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @param {string} [deviceType] - Values - 'output', 'input' or undefined.
* Default - 'input'.
* @returns {Promise}
*/
export function isDeviceChangeAvailable(transport, deviceType) {
return transport.sendRequest({
deviceType,
type: 'devices',
name: 'isDeviceChangeAvailable'
});
}
/**
* Returns Promise that resolves with true if multiple audio input is supported
* and with false if not.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @returns {Promise}
*/
export function isMultipleAudioInputSupported(transport) {
return transport.sendRequest({
type: 'devices',
name: 'isMultipleAudioInputSupported'
});
}
/**
* Sets the audio input device to the one with the label or id that is passed.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @param {string} label - The label of the new device.
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setAudioInputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'audioinput',
label
});
}
/**
* Sets the audio output device to the one with the label or id that is passed.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @param {string} label - The label of the new device.
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setAudioOutputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'audiooutput',
label
});
}
/**
* Sets the currently used device to the one that is passed.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @param {Object} device - The new device to be used.
* @returns {Promise}
*/
function _setDevice(transport, device) {
return transport.sendRequest({
type: 'devices',
name: 'setDevice',
device
});
}
/**
* Sets the video input device to the one with the label or id that is passed.
*
* @param {Transport} transport - The @code{Transport} instance responsible for
* the external communication.
* @param {string} label - The label of the new device.
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setVideoInputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'videoinput',
label
});
}

3
modules/API/external/index.js vendored Normal file
View File

@@ -0,0 +1,3 @@
// For legacy purposes, preserve the UMD of the public API of Jitsi Meet
// external API (a.k.a. JitsiMeetExternalAPI).
module.exports = require('./external_api').default;

2
modules/API/index.js Normal file
View File

@@ -0,0 +1,2 @@
export { default } from './API';
export * from './constants';