videoSources, audioSources, audioDestinations

wrtc.get("videoSources"), wrtc.get("audioSources") and wrtc.get("audioDestinations") return a list of video sources (cams), local audio sources (mics) and local audio destinations (speakers) available.

The arrays contain MediaDeviceInfo objects, one for each available device.

Property label of each object contains a descriptive name of the media device, eg "External USB Webcam"

Property deviceId of each object contains the unique ID for that media device that you need to set wrtc.audioSource, wrtc.audioDestination or wrtc.videoSource to to select that audio or video device.

Only available in Chrome and Safari

If attempted to wrtc.get() the lists on other browsers the lists will be empty.

If attempted to wrtc.get() the lists before wrtc.onSources() occurred the lists will be empty.

Events

Event function wrtc.onSources() is called when the lists of devices are available (usually within a second after page load). If attempted to wrtc.get() the lists before that they will be empty.

Example

wrtc.get("audioSources")
[0]:
deviceId: "23ddd3ce6002d19d969aca83d879b86427180cad082db609cf55d6b64cc495b0"
groupId: "ddff0f646a3bc4572e80e2f72e9285486535cdb2a1b90169215cdfecd35c2658"
id: "23ddd3ce6002d19d969aca83d879b86427180cad082db609cf55d6b64cc495b0"
kind: "audioinput"
label: "Dock Mik (IDT High Definition Audio CODEC)"
[1]:
deviceId: "f84adfce6f126cc2926f0098c2e27441a6ab65c4a4e8ff49d73e72872d2131f0"
groupId: "56772ebfd198d2abcc0d565975232d640c18110e51b6a8c2d28ad4652e10b40c"
id: "f84adfce6f126cc2926f0098c2e27441a6ab65c4a4e8ff49d73e72872d2131f0"
kind: "audioinput"
label: "Linje (Apowersoft_AudioDevice)"
[2]:
deviceId: "a0393cdbb3f794328b21d03386b7ba503d1fa6239c71b320084ee2b4954e9da6"
groupId: "ddff0f646a3bc4572e80e2f72e9285486535cdb2a1b90169215cdfecd35c2658"
id: "a0393cdbb3f794328b21d03386b7ba503d1fa6239c71b320084ee2b4954e9da6"
kind: "audioinput"
label: "Ingång Mik (IDT High Definition Audio CODEC)"

ixnx/wrtc/js/api/sources_array.txt · Last modified: by migration
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0