import UserMedia from '@mobilizing/library/js/Mobilizing/input/UserMedia.js'
UserMedia
Extends:
UserMedia class give access to navigator.mediaDevices.getUserMedia with various simplification of access
Constructor Summary
Public Constructor | ||
public | constructor(params: Object) |
Member Summary
Public Members | ||
public | audioDevices: *[] List of all available audio devices | |
public | audioStream: * the current device audio stream reference | |
public | callback: * | |
public | canvas: * the prefortatted canvas element into which the video stream can be drawn. | |
public | choiceMenu: * | |
public | constraints: * | |
public | createCanvas: * | |
public | ||
public | ||
public | deviceKind: * | |
public | deviceLabel: * | |
public | devices: *[] List of all available devices | |
public | stream actual capabalities, for debugging purpose | |
public | stream actual settings, for debugging purpose | |
public | ||
public | videoDevices: *[] List of all available video devices | |
public | videoEl: * the video element to which the video stream is attached to | |
public | videoStream: * the current device video stream reference |
Private Members | ||
private | deviceToOpen: * the current device to be opened |
Method Summary
Public Methods | ||
public | audioStreamOpened(stream: Object) success callback when requesting audio input stream | |
public | off() Deactivate the component | |
public | on() Activates the component | |
public | setup() Set the UserMedia up. | |
public | streamError(err: String) Use in the getUserMedia promise to check errors | |
public | videoStreamOpened(stream: Object) success callback when requesting audio input stream |
Private Methods | ||
private | devicesFound(devices: Object) Use internally to find the best device according to the infos given by the user | |
private | openDevice(device: Object) open the device that has been found by devicesFound() |
Inherited Summary
From class Component | ||
public | ||
public | context: * | |
public | events: * | |
public | id: * | |
public | name: * | |
private | _nexts: *[] | |
private | ||
public | byPass() | |
public | Adds a component to this chained component array | |
public | Returns the array of attached children components | |
public | off() Deactivate the component | |
public | on() Activate the component A call to this method calls the setup method if it has not been run yet | |
public | Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism | |
public | preLoad() preLoad the component This empty method is usually overriden to perform preLoad actions for the component. | |
public | Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism | |
public | prepare() prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server. | |
public | setup() Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly | |
public | update() Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism |
Public Constructors
public constructor(params: Object) source
Override:
Component#constructorParams:
Name | Type | Attribute | Description |
params | Object | Parameters object, given by the constructor. | |
params.constraints | Object | getUserMedia constraints (https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints) | |
params.deviceKind | String | "videoinput" || "audioinput" | |
params.deviceLabel | String | the label given by the device when the brower has autorizations to access it before users say so with authorization dialogue box | |
params.useNativeResolution | Boolean | default=false, if true, the native resolution for the video device will be automatically searched and applied to video element and canvas element | |
params.createElement | Boolean | default=true, if true, will generate a <video> element internally for simple display of the video stream (requiered anyway on iOS) | |
params.createCanvas | Boolean | default=true, if true, will generate a <canvas> element internally for frame by frame pixels operation. the canvas should be accessed in the callback | |
params.callback | Function | the function called back when the "canplay" event is triggered by the stream after opening. This is where you can do what ever you want with the stream, through videoEl or canvas |
Public Members
public audioDevices: *[] source
List of all available audio devices
public audioStream: * source
the current device audio stream reference
public callback: * source
public canvas: * source
the prefortatted canvas element into which the video stream can be drawn. this canvas has the same size has the video stream
Properties:
Name | Type | Attribute | Description |
canvas | * |
public choiceMenu: * source
public constraints: * source
public createCanvas: * source
public createChoiceMenu: * source
public createElement: * source
public deviceKind: * source
public deviceLabel: * source
public devices: *[] source
List of all available devices
public streamCapabilities: * source
stream actual capabalities, for debugging purpose
Properties:
Name | Type | Attribute | Description |
streamCapabilities | Object |
public streamSettings: * source
stream actual settings, for debugging purpose
Properties:
Name | Type | Attribute | Description |
streamSettings | Object |
public useNativeResolution: * source
public videoDevices: *[] source
List of all available video devices
public videoEl: * source
the video element to which the video stream is attached to
Properties:
Name | Type | Attribute | Description |
videoEl | * |
public videoStream: * source
the current device video stream reference
Private Members
private deviceToOpen: * source
the current device to be opened
Public Methods
public audioStreamOpened(stream: Object) source
success callback when requesting audio input stream
Params:
Name | Type | Attribute | Description |
stream | Object | the incoming stream to be used |
public streamError(err: String) source
Use in the getUserMedia promise to check errors
Params:
Name | Type | Attribute | Description |
err | String |
public videoStreamOpened(stream: Object) source
success callback when requesting audio input stream
Params:
Name | Type | Attribute | Description |
stream | Object | the incoming stream to be used |