MediaStream extension type
The MediaStream
interface of the Media Capture and Streams API
represents a stream of media content. A stream consists of several
tracks, such as video or audio tracks. Each track is specified as an
instance of MediaStreamTrack.
You can obtain a MediaStream
object either by using the constructor or by
calling functions such as MediaDevices.getUserMedia,
MediaDevices.getDisplayMedia, or HTMLCanvasElement.captureStream and
HTMLMediaElement.captureStream.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- MediaStream([JSObject streamOrTracks])
-
factory
Properties
- active → bool
-
The
active
read-only property of the MediaStream interface returns a Boolean value which istrue
if the stream is currently active; otherwise, it returnsfalse
. A stream is considered active if at least one of its MediaStreamTracks does not have its property MediaStreamTrack.readyState set toended
. Once every track has ended, the stream'sactive
property becomesfalse
.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The
id
read-only property of the MediaStream interface is a string containing 36 characters denoting a unique identifier (GUID) for the object.no setter - onaddtrack ↔ EventHandler?
-
getter/setter pair
- onremovetrack ↔ EventHandler?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
addEventListener()
method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.inherited -
addTrack(
MediaStreamTrack track) → void -
The
addTrack()
method of the MediaStream interface adds a new track to the stream. The track is specified as a parameter of type MediaStreamTrack. -
clone(
) → MediaStream -
The
clone()
method of the MediaStream interface creates a duplicate of theMediaStream
. This newMediaStream
object has a new unique MediaStream.id and contains clones of every MediaStreamTrack contained by theMediaStream
on whichclone()
was called. -
dispatchEvent(
Event event) → bool -
The
dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually withdispatchEvent()
.inherited -
getAudioTracks(
) → JSArray< MediaStreamTrack> -
The
getAudioTracks()
method of the MediaStream interface returns a sequence that represents all the MediaStreamTrack objects in this stream'strack set
where MediaStreamTrack.kind isaudio
. -
getTrackById(
String trackId) → MediaStreamTrack? -
The
getTrackById()
method of the MediaStream interface returns a MediaStreamTrack object representing the track with the specified ID string. If there is no track with the specified ID, this method returnsnull
. -
getTracks(
) → JSArray< MediaStreamTrack> -
The
getTracks()
method of the MediaStream interface returns a sequence that represents all the MediaStreamTrack objects in this stream'strack set
, regardless of MediaStreamTrack.kind. -
getVideoTracks(
) → JSArray< MediaStreamTrack> -
The
getVideoTracks()
method of the MediaStream interface returns a sequence of MediaStreamTrack objects representing the video tracks in this stream. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.inherited -
removeTrack(
MediaStreamTrack track) → void -
The
removeTrack()
method of the MediaStream interface removes a MediaStreamTrack from a stream. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited