Module webrtc.java

Class MediaStreamTrack

  • Direct Known Subclasses:
    AudioTrack, VideoTrack

    public abstract class MediaStreamTrack
    extends dev.onvoid.webrtc.internal.DisposableNativeObject
    The MediaStreamTrack represents media of a single type that originates from one media source, e.g. video produced by a web camera.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MediaStreamTrack()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Invoke native object destructors and free native resources.
      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.
      String getKind()
      Returns the string "audio" if this object represents an audio track or "video" if this object represents a video track.
      MediaStreamTrackState getState()
      Represents the state of the media track.
      boolean isEnabled()
      Indicates if this media track is enabled or not.
      void setEnabled​(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
    • Constructor Detail

      • MediaStreamTrack

        protected MediaStreamTrack()
    • Method Detail

      • dispose

        public void dispose()
        Description copied from class: dev.onvoid.webrtc.internal.DisposableNativeObject
        Invoke native object destructors and free native resources.
        Specified by:
        dispose in class dev.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.