- java.lang.Object
-
- dev.onvoid.webrtc.internal.NativeObject
-
- dev.onvoid.webrtc.internal.DisposableNativeObject
-
- dev.onvoid.webrtc.media.MediaStreamTrack
-
- Direct Known Subclasses:
AudioTrack,VideoTrack
public abstract class MediaStreamTrack extends dev.onvoid.webrtc.internal.DisposableNativeObjectThe MediaStreamTrack represents media of a single type that originates from one media source, e.g. video produced by a web camera.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUDIO_TRACK_KINDIf this object represents an audio track.static StringVIDEO_TRACK_KINDIf this object represents a video track.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMediaStreamTrack()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Invoke native object destructors and free native resources.StringgetId()When a MediaStreamTrack is created, the application must generate an identifier string, and must initialize the object's id attribute to that string, unless the object is created as part of a special purpose algorithm that specifies how the stream id must be initialized.StringgetKind()Returns the string "audio" if this object represents an audio track or "video" if this object represents a video track.MediaStreamTrackStategetState()Represents the state of the media track.booleanisEnabled()Indicates if this media track is enabled or not.voidsetEnabled(boolean enable)Controls the enabled state for the media track.
-
-
-
Field Detail
-
AUDIO_TRACK_KIND
public static final String AUDIO_TRACK_KIND
If this object represents an audio track.- See Also:
- Constant Field Values
-
VIDEO_TRACK_KIND
public static final String VIDEO_TRACK_KIND
If this object represents a video track.- See Also:
- Constant Field Values
-
-
Method Detail
-
dispose
public void dispose()
Description copied from class:dev.onvoid.webrtc.internal.DisposableNativeObjectInvoke native object destructors and free native resources.- Specified by:
disposein classdev.onvoid.webrtc.internal.DisposableNativeObject
-
getKind
public String getKind()
Returns the string "audio" if this object represents an audio track or "video" if this object represents a video track.- Returns:
- "audio" if this object is an audio track or "video" if this object is a video track.
-
getId
public String getId()
When a MediaStreamTrack is created, the application must generate an identifier string, and must initialize the object's id attribute to that string, unless the object is created as part of a special purpose algorithm that specifies how the stream id must be initialized.- Returns:
- The identifier string of this track.
-
isEnabled
public boolean isEnabled()
Indicates if this media track is enabled or not.- Returns:
- true if enabled, false otherwise.
-
setEnabled
public void setEnabled(boolean enable)
Controls the enabled state for the media track. A disabled track will produce silence (if audio) or black frames (if video). After a MediaStreamTrack has ended, its enabled attribute still changes value when set; it just doesn't do anything wit that new value.- Parameters:
enable- The new value.
-
getState
public MediaStreamTrackState getState()
Represents the state of the media track. A track will never be live again after becoming ended.- Returns:
- The current media track state.
-
-