Repository

UserMedia

Extends:

Component → UserMedia

UserMedia class give access to navigator.mediaDevices.getUserMedia with various simplification of access

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

List of all available audio devices

public

the current device audio stream reference

public
public

canvas: *

the prefortatted canvas element into which the video stream can be drawn.

public
public
public
public
public
public
public
public

devices: *[]

List of all available devices

public

stream actual capabalities, for debugging purpose

public

stream actual settings, for debugging purpose

public
public

List of all available video devices

public

the video element to which the video stream is attached to

public

the current device video stream reference

Private Members
private

the current device to be opened

Method Summary

Public Methods
public

success callback when requesting audio input stream

public

off()

Deactivate the component

public

on()

Activates the component

public

Set the UserMedia up.

public

Use in the getUserMedia promise to check errors

public

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
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

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 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 the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

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 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#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.constraintsObject

getUserMedia constraints (https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints)

params.deviceKindString

"videoinput" || "audioinput"

params.deviceLabelString

the label given by the device when the brower has autorizations to access it before users say so with authorization dialogue box

params.useNativeResolutionBoolean

default=false, if true, the native resolution for the video device will be automatically searched and applied to video element and canvas element

params.createElementBoolean

default=true, if true, will generate a <video> element internally for simple display of the video stream (requiered anyway on iOS)

params.createCanvasBoolean

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.callbackFunction

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:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
streamCapabilitiesObject

public streamSettings: * source

stream actual settings, for debugging purpose

Properties:

NameTypeAttributeDescription
streamSettingsObject

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:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
streamObject

the incoming stream to be used

public off() source

Deactivate the component

Override:

Component#off

public on() source

Activates the component

Override:

Component#on

public setup() source

Set the UserMedia up.

Override:

Component#setup

public streamError(err: String) source

Use in the getUserMedia promise to check errors

Params:

NameTypeAttributeDescription
errString

public videoStreamOpened(stream: Object) source

success callback when requesting audio input stream

Params:

NameTypeAttributeDescription
streamObject

the incoming stream to be used

Private Methods

private devicesFound(devices: Object) source

Use internally to find the best device according to the infos given by the user

Params:

NameTypeAttributeDescription
devicesObject

object given by the Promise launched by enumerateDevices()

private openDevice(device: Object) source

open the device that has been found by devicesFound()

Params:

NameTypeAttributeDescription
deviceObject

the device to open