This was an experimental technology
Because This technology ' s specification have not stabilized, check the compatibility table for the proper prefixes to use I n various browsers. Also Note the syntax and behavior of an experimental technology are subject to change in future versions of browsers a s the spec changes.
MediaStream
The interface represents a stream of media content. A Stream consists of several tracks, like video or audio tracks.
Attributes
-
MediaStream.ended
Read only
-
is a Boolean value with a value
true
ended
of If the event have been fired on the object, meaning the St Ream has been completely read, or
false
if the end of the hte stream have not been reached.
-
MediaStream.id
Read only
Is
-
a
DOMString
containing-characters denoting a unique identifier (GUID) for the object.
Event handlers
-
MediaStream.onaddtrack
-
Was a
EventHandler
containing the action to perform if an
addtrack
event was fired on the object, that's when a new
MediaStreamTrack
Object is added.
-
MediaStream.onended
-
is a
EventHandler
containing the action to perform if an
ended
event was fired on the object, that's when the streaming I s terminating.
-
MediaStream.onremovetrack
-
was a
EventHandler
containing the action to perform if an
removetrack
event was fired on the object, that's when a
MediaStreamTrack
object is removed from it.
Methods
-
MediaStream.addTrack()
-
Stores A copy of the
MediaStreamTrack
given as argument. If the track had already been added
MediaStream
to the object and nothing happens;
finished
S has already reached it end, the exception is
INVALID_STATE_RAISE
raised.
-
MediaStream.clone()
-
Return A clone of the
MediaStream
objet. The clone would have a new ID value.
-
Returns The track whose ID corresponds to the one given in parameters,
trackid
. If no parameter is given, or if no track with that ID does exists, it returns
null
. If several tracks has the same ID, it returns the first one.
-
MediaStream.getAudioTracks()
-
Returns A list of the stored in the object that has
MediaStreamTrack
MediaStream
their
kind
attribute set to
"audio"
. The order is not a defined, and may vary from one browser to a and the also from one of the method to another.
-
MediaStream.getTrackById()
-
Returns the track whose ID corresponds to the one given in parameters,
trackid
. If no parameter is given, or if no track with that ID does exists, it returns
null
. If several tracks has the same ID, it returns the first one.
-
MediaStream.getVideoTracks()
-
Returns A list of the stored in the object that has
MediaStreamTrack
MediaStream
their
kind
attribute set to
"video"
. The order is not a defined, and may vary from one browser to a and the also from one of the method to another.
-
MediaStream.removeTrack()
-
removes the
MediaStreamTrack
given as argument. If the track was not part
MediaStream
of the of the object, nothing happens;
finished
Eady reached its end, the exception is
INVALID_STATE_RAISE
raised.
Mediastreamtracksummary
MediaStream
The interface represents a stream of media content. A Stream consists of several tracks, like video or audio tracks.
Properties
-
-
MediaStreamTrack.enabled
-
-
is a Boolean value with a value
true
of if the track was enabled, that's allowed to render the media source Strea M Or
false
if it is disabled, which is not rendering the media source stream but silence and blackness. If the track had been disconnected, this value can be changed but have no more effect.
-
-
MediaStreamTrack.id
Read only
-
-
Returns A
DOMString
containing a unique identifier (GUID)
for the track; it's generated by the browser.
-
-
MediaStreamTrack.kind
Read only
-
-
Returns a
DOMString
set
"audio"
to if the track was an audio track
"video"
and to, if it was a video track. It doesn ' t change if the track was deassociated from its source.
-
-
MediaStreamTrack.label
Read only
-
-
Returns A
DOMString
containing a user agent-assigned label that identifies the track source, as in
"internal microphone"
. The string may be left empty and was empty as long as no source has been connected. When the track was deassociated from its source, the label was not changed.
-
-
MediaStreamTrack.muted
Read only
-
-
Returns a Boolean value with a value
true
of if the track is muted,
false
otherwise.
-
-
MediaStreamTrack.readonly
Read only
-
-
Returns a Boolean value with a value of an if the track was
true
readonly (such a video file source or a camera that Settings can ' t be modified),
false
otherwise.
-
-
MediaStreamTrack.readyState
Read only
-
-
Returns An enumerated value giving the status of the. It takes one of the following values:
"live"
Which indicates that a input is connected and does it best-effort in providing real-time data. In this case, the output of data can is switched on or off using the MediaStreamTrack.enabled
attribute.
"ended"
Which indicates that the input was not giving any more data and would never provide new data.
-
-
MediaStreamTrack.remote
Read only
-
-
Returns A Boolean value with a value
true
of if the track was sourced by a
RTCPeerConnection
,
false
otherwise.
Event handlers
-
-
MediaStreamTrack.onstarted
-
-
is a
EventHandler
containing the action to perform if an
started
event was fired on the object, that's when a new object is added.
-
-
MediaStreamTrack.onmute
-
-
is a
EventHandler
containing the action to perform if an
mute
event was fired on the object, that's when the Stre Aming is terminating.
-
-
MediaStreamTrack.onunmute
-
-
was a
EventHandler
containing the action to perform if an
unmute
event was fired on the object, that's when a
MediaStreamTrack
object is removed from it.
-
-
MediaStreamTrack.onoverconstrained
-
-
was a
EventHandler
containing the action to perform if an
overconstrained
event was fired on the object, that's when a
MediaStreamTrack
object is removed from it.
-
-
MediaStreamTrack.oneended
-
-
is a
EventHandler
containing the action to perform if an
ended
event was fired on the object, that's when a object is removed from it.
Methods
-
MediaStreamTrack.getConstraints()
-
MediaStreamTrack.applyConstraints()
-
MediaStreamTrack.getSettings()
-
MediaStreamTrack.getCapabilities()
-
MediaStreamTrack.clone()
-
MediaStreamTrack.stop()
-
Stops playing the source associated to the track, both the source and the track is deassociated. The track was set to
ended
.
Specifications
Specification |
Status |
Comment |
Media Capture and Streams The definition of ' mediastreamtrack ' in that specification. |
Candidate Recommendation |
Initial definition |
Https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack
Https://developer.mozilla.org/en-US/docs/Web/API/MediaStream
WEBRTC Learning--mediastream and Mediastreamtrack