openvidu-browser: restrict Device.kind string type

pull/761/head
pabloFuente 2022-11-15 15:49:46 +01:00
parent fc93566e04
commit 6576f40db8
2 changed files with 4 additions and 4 deletions

View File

@ -377,8 +377,8 @@ export class OpenVidu {
let videoDevices: Device[] = []; let videoDevices: Device[] = [];
let audioDevices: Device[] = []; let audioDevices: Device[] = [];
pluginAudioDevices = pluginDevices.filter((device: Device) => device.kind === 'audioinput'); pluginAudioDevices = pluginDevices.filter((device: Device) => device.kind === 'audioinput');
videoDevices = deviceInfos.filter((device: Device) => device.kind === 'videoinput'); videoDevices = deviceInfos.filter((device: MediaDeviceInfo) => device.kind === 'videoinput') as any;
audioDevices = deviceInfos.filter((device: Device) => device.kind === 'audioinput'); audioDevices = deviceInfos.filter((device: MediaDeviceInfo) => device.kind === 'audioinput') as any;
videoDevices.forEach((deviceInfo, index) => { videoDevices.forEach((deviceInfo, index) => {
if (!deviceInfo.label) { if (!deviceInfo.label) {
let label = ''; let label = '';

View File

@ -20,9 +20,9 @@
*/ */
export interface Device { export interface Device {
/** /**
* `"videoinput"`, `"audioinput"` * The kind of device
*/ */
kind: string; kind: 'videoinput' | 'audioinput';
/** /**
* Unique ID for the device. Use it on `audioSource` or `videoSource` properties of [[PublisherProperties]] * Unique ID for the device. Use it on `audioSource` or `videoSource` properties of [[PublisherProperties]]