Module webrtc.java

Class RTCRtpTransceiver

java.lang.Object
dev.onvoid.webrtc.internal.NativeObject
dev.onvoid.webrtc.RTCRtpTransceiver

public class RTCRtpTransceiver extends dev.onvoid.webrtc.internal.NativeObject
Represents a combination of an RTCRtpSender and an RTCRtpReceiver that share a common media ID (mid).
Author:
Alex Andres
  • Method Details

    • getMid

      public String getMid()
      The mid attribute is the mid negotiated and present in the local and remote descriptions. Before negotiation is complete, the mid value may be null. After rollbacks, the value may change from a non-null value to null.
      Returns:
      The media stream identification associated with local and remote descriptions.
    • getSender

      public RTCRtpSender getSender()
      The RTCRtpSender corresponding to the RTP media that may be sent with mid = mid.
      Returns:
      The RTP sender associated with this transceiver.
    • getReceiver

      public RTCRtpReceiver getReceiver()
      The RTCRtpReceiver corresponding to the RTP media that may be received with mid = mid.
      Returns:
      The RTP receiver associated with this transceiver.
    • getDirection

      public RTCRtpTransceiverDirection getDirection()
      Indicates the preferred direction of this transceiver, which will be used in calls to createOffer and createAnswer.
      Returns:
      The preferred direction of this transceiver.
    • setDirection

      public void setDirection(RTCRtpTransceiverDirection direction)
      Sets the preferred direction of this transceiver. An update of directionality does not take effect immediately. Instead, future calls to createOffer and createAnswer mark the corresponding media description as SendRecv, SendOnly, RecvOnly or Inactive.
      Parameters:
      direction - The new transceiver direction.
    • getCurrentDirection

      public RTCRtpTransceiverDirection getCurrentDirection()
      Indicates the current direction negotiated for this transceiver. The value of currentDirection is independent of the value of RTCRtpEncodingParameters.active since one cannot be deduced from the other. If this transceiver has never been represented in an offer/answer exchange, or if the transceiver is stopped, the value is null.
      Returns:
      The current direction negotiated for this transceiver.
    • stop

      public void stop()
      Irreversibly stops the RTCRtpTransceiver. The sender of this transceiver will no longer send, the receiver will no longer receive. Calling stop() updates the negotiation-needed flag for the RTCRtpTransceiver's associated RTCPeerConnection. Stopping a transceiver will cause future calls to createOffer or createAnswer to generate a zero port in the media description for the corresponding transceiver.
    • stopped

      public boolean stopped()
      Indicates that the sender of this transceiver will no longer send, and that the receiver will no longer receive. It is true if either stop has been called or if setting the local or remote description has caused the RTCRtpTransceiver to be stopped.
      Returns:
      true if the transceiver has been stopped, false otherwise.
    • getCodecPreferences

      public List<RTCRtpCodecCapability> getCodecPreferences()
      Returns the default codec preferences used by WebRTC for this transceiver.
      Returns:
      The default codec preferences.
    • setCodecPreferences

      public void setCodecPreferences(List<RTCRtpCodecCapability> preferences)
      Overrides the default codec preferences used by WebRTC for this transceiver. When generating a session description using either RTCPeerConnection.createOffer or RTCPeerConnection.createAnswer, the RTCPeerConnection will use the indicated codecs, in the order specified in the provided preferences.

      This method allows applications to disable the negotiation of specific codecs (including RTX/RED/FEC). It also allows an application to cause a remote peer to prefer the codec that appears first in the list for sending.

      Setting codecs to an empty sequence resets codec preferences to any default value.

      Parameters:
      preferences - The preferred codec preferences.