Media
Helpers for MediaDevices and MediaStreamConstraints.
Static Member Summary
Static Public Members | ||
public static get |
facingMode: {USER: string, ENVIRONMENT: string}: {"USER": string, "ENVIRONMENT": string} facingMode values to use with constraints |
Static Method Summary
Static Public Methods | ||
public static |
attachStream(mediaStream: MediaStream, container: Element, previous: Element, volume: number): Element Init stream display node depending on stream type |
|
public static |
constraints(videoConstraints: boolean | MediaTrackConstraints | string, audioConstraints: boolean | MediaTrackConstraints, type: string, videoDeviceId: string | object, audioDeviceId: string | object): object Helpers to create a MediaStreamConstraints configuration object |
|
public static |
devices(): Promise<{audioinput: MediaDeviceInfo[], videoinput: MediaDeviceInfo[]}>{audioinput:> List available input devices |
Static Public Members
Static Public Methods
public static attachStream(mediaStream: MediaStream, container: Element, previous: Element, volume: number): Element source
Init stream display node depending on stream type
Params:
Name | Type | Attribute | Description |
mediaStream | MediaStream | The MediaStream to display |
|
container | Element | Container node for streams |
|
previous | Element | Previous node for the stream |
|
volume | number |
|
the default volume |
public static constraints(videoConstraints: boolean | MediaTrackConstraints | string, audioConstraints: boolean | MediaTrackConstraints, type: string, videoDeviceId: string | object, audioDeviceId: string | object): object source
Helpers to create a MediaStreamConstraints configuration object
Params:
Name | Type | Attribute | Description |
videoConstraints | boolean | MediaTrackConstraints | string |
|
a boolean, a video constraints object or a preset id (UHD, FHD, HD, SVGA, SD, VGA) |
audioConstraints | boolean | MediaTrackConstraints |
|
a boolean or an audio constraints object |
type | string |
|
type of constraints for video when using a preset (exact,min,max or ideal) |
videoDeviceId | string | object |
|
video input device id or facingMode |
audioDeviceId | string | object |
|
audio input device id |
Throw:
Example:
let myConstraints = Reach.media.constraints();
console.log(myConstraints);
let myConstraints = Reach.media.constraints('FHD', false, 'exact');
console.log(myConstraints);
public static devices(): Promise<{audioinput: MediaDeviceInfo[], videoinput: MediaDeviceInfo[]}>{audioinput:> source
List available input devices
Example:
Reach.media.devices().then(devices => {
// Video cameras
console.log(devices.videoinput);
// Audio mics
console.log(devices.audioinput);
});