Classes
Members
-
capabilities :MediaTrackCapabilities
-
Description
A
MediaTrackCapabilities
object detailing the exact capabilities of the video track (ornull
if no video track is currently open).Details
-
capture :ImageCapture
-
Description
An
ImageCapture
object used to grab frames per the ImageCapture API.Details
-
constraints :MediaTrackConstraints
-
Description
The constraints which must be met by the video track. At the minimum, the value
true
is used which means all input video streams.Details
-
opacity :number
-
Description
The opacity of the
<video>
element used to display the video stream (between 0 and 1).Details
-
settings :MediaTrackSettings
-
Description
A
MediaTrackSettings
object detailing the precise settings of the video track (ornull
if no stream is open).Details
-
started :boolean
-
Description
Whether or not the video input is currently started.
Details
-
stream :MediaStream
-
Description
The actual media stream that is currently being used.
Details
-
timeouts :Object
-
Description
An object containing the timeouts used throughout this class (mostly for internal use)
Details
-
track :MediaStreamTrack
-
Description
The video track currently being used. This will be
null
if there are no active stream.Details
-
video :HTMLMediaElement
-
Description
The
<video>
element used to display the video feed (may benull
if none is used)Details
Methods
-
cancelFade()
-
Description
Cancels any fade ins or fade outs that are currently ongoing.
Details
-
<async> destroy() → {Promise.<void>}
-
Description
Properly destroys this object and all internal references. By calling this method when you are done with this object, you insure there are no lingering listeners or processes.
Returns
Details
-
<async> fade( [ type [, duration ] ] ) → {Promise.<void>}
-
Description
Fades the
<video>
element in or out for the specified duration.Parameters
Name Type Attributes Default Description type
string <optional> "in" Type of fade ("in" or "out")
duration
number <optional> 5000 Duration of fade in milliseconds
Returns
Details
-
<async> fadeIn( [ duration ] ) → {Promise.<void>}
-
Description
Fades in the
<video>
element used to display the video feed.Parameters
Name Type Attributes Default Description duration
number <optional> 5000 Duration of the fade in (in milliseconds)
Returns
Details
-
<async> fadeOut( [ duration ] ) → {Promise.<void>}
-
Description
Fades out the
<video>
element used to display the video feed.Parameters
Name Type Attributes Default Description duration
number <optional> 5000 Duration of the fade out (in milliseconds)
Returns
Details
-
<async> grabFrame( [ options ] ) → {Promise.<(ImageBitmap|DOMString|Blob)>}
-
Description
Grabs a frame from the video stream and returns it in the specified data format.
Parameters
Name Type Attributes Description options
Object <optional> Name Type Attributes Default Description format
string <optional> "ImageBitmap" The format to return the image data in. Can be: "ImageBitmap" (default), "Blob" or "ObjectURL".
mimeType
string <optional> "image/png" If the image is being returned as a
Blob
, you can specify the MIME type of that blob. Typically, this will be "image/png" (default) or "image/jpeg" but can also be any image MIME type supported by the environment.quality
number <optional> For certain MIME types such as
image/jpeg
orimage/webp
, a quality parameter can be specified. This should be a float between 0 and 1.Returns
Details
-
<async> start( [ options ] ) → {Promise.<void>}
-
Description
Tries to find a video stream matching the specified constraints. If one is found, the stream is attached to the
<video>
element specified upon construction of theVideoInput
object (if any).Parameters
Name Type Attributes Description options
Object <optional> Name Type Attributes Default Description deviceId
boolean <optional> The id of a specific device to connect to. Device IDs can be viewed by calling the
getInputs()
method.visible
boolean <optional> true Whether the
<video>
element should initially be visible or not.constraints
MediaTrackConstraints <optional> The video constraints to apply when looking for an input video track (see MediaTrackConstraints for more info).
Returns
Details
-
<async> stop() → {Promise.<void>}
-
Description
Disconnects the video input and stops all associated tracks.
Returns
Details