feat(iframe-api): Device handling.

This commit is contained in:
Hristo Terezov
2019-03-29 15:42:02 +00:00
parent 659e420005
commit 427f49367b
7 changed files with 434 additions and 144 deletions
+90
View File
@@ -7,6 +7,16 @@ import {
} from '../../transport';
import electronPopupsConfig from './electronPopupsConfig.json';
import {
getAvailableDevices,
getCurrentDevices,
isDeviceChangeAvailable,
isDeviceListAvailable,
isMultipleAudioInputSupported,
setAudioInputDevice,
setAudioOutputDevice,
setVideoInputDevice
} from './functions';
const logger = require('jitsi-meet-logger').getLogger(__filename);
@@ -593,6 +603,24 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
}
}
/**
* Returns Promise that resolves with result an list of available devices.
*
* @returns {Promise}
*/
getAvailableDevices() {
return getAvailableDevices(this._transport);
}
/**
* Returns Promise that resolves with current selected devices.
*
* @returns {Promise}
*/
getCurrentDevices() {
return getCurrentDevices(this._transport);
}
/**
* Check if the audio is available.
*
@@ -605,6 +633,38 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
});
}
/**
* Returns Promise that resolves with true if the device change is available
* and with false if not.
*
* @param {string} [deviceType] - Values - 'output', 'input' or undefined.
* Default - 'input'.
* @returns {Promise}
*/
isDeviceChangeAvailable(deviceType) {
return isDeviceChangeAvailable(this._transport, deviceType);
}
/**
* Returns Promise that resolves with true if the device list is available
* and with false if not.
*
* @returns {Promise}
*/
isDeviceListAvailable() {
return isDeviceListAvailable(this._transport);
}
/**
* Returns Promise that resolves with true if the device list is available
* and with false if not.
*
* @returns {Promise}
*/
isMultipleAudioInputSupported() {
return isMultipleAudioInputSupported(this._transport);
}
/**
* Invite people to the call.
*
@@ -771,6 +831,36 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
});
}
/**
* Sets the audio input device to the one with the id that is passed.
*
* @param {string} deviceId - The id of the new device.
* @returns {Promise}
*/
setAudioInputDevice(deviceId) {
return setAudioInputDevice(this._transport, deviceId);
}
/**
* Sets the audio output device to the one with the id that is passed.
*
* @param {string} deviceId - The id of the new device.
* @returns {Promise}
*/
setAudioOutputDevice(deviceId) {
return setAudioOutputDevice(this._transport, deviceId);
}
/**
* Sets the video input device to the one with the id that is passed.
*
* @param {string} deviceId - The id of the new device.
* @returns {Promise}
*/
setVideoInputDevice(deviceId) {
return setVideoInputDevice(this._transport, deviceId);
}
/**
* Returns the configuration for electron for the windows that are open
* from Jitsi Meet.