Contents

SelectMediaDeviceParams

Parameters for a media device selection request.

import { SelectMediaDeviceParams } from '@mobrowser/api';

Example 

import { BrowserWindow, SelectMediaDeviceParams } from '@mobrowser/api';

const win = new BrowserWindow()
win.browser.handle('selectMediaDevice', async (params: SelectMediaDeviceParams) => {
  return params.devices[0].id
})

Properties 

devices 

readonly devices: MediaDevice[];

The available devices of a single media device type, all sharing the same MediaDevice.type.

The handler is invoked at most once per requested device type, so a request for both a microphone and a camera invokes it twice: once with the audio devices and once with the video devices. A single invocation therefore cannot choose both, and the returned id must belong to this array.

A requested type with no available devices is skipped entirely: this array is never empty, and a machine with no camera or microphone simply produces no invocation for the video or audion devices rather than one with an empty list.

browser 

readonly browser: Browser;

The browser instance requesting the device selection.