io.agora.rtc

## Class AgoraRemoteAudioTrack

- java.lang.Object
- - io.agora.rtc.AgoraRemoteAudioTrack

-     public class AgoraRemoteAudioTrack
      extends java.lang.Object

  Represents a remote audio track received from other users in a channel.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private long` | `cptr` Native pointer to the remote audio track resource.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgoraRemoteAudioTrack(long cptr)` Constructs a remote audio track.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Destroys the remote audio track.
    `(package private) void` | `destroyStatistics(RemoteAudioTrackStats stats)` Destroys the provided RemoteAudioTrackStats object.
    `long` | `getNativeHandle()` Gets the native handle of the remote audio track.
    `int` | `getState()` Gets the current state of the remote audio track.
    `RemoteAudioTrackStats` | `getStatistics()` Retrieves the statistics of the remote audio track.
    `private void` | `nativeDestroy(long cptr)` Releases the native remote audio track handle.
    `private void` | `nativeDestroyStatistics(long cptr, RemoteAudioTrackStats stats)` Releases a statistics object that was created natively.
    `private int` | `nativeGetState(long cptr)` Retrieves the native state value of the audio track.
    `private RemoteAudioTrackStats` | `nativeGetStatistics(long cptr)` Obtains statistics for the remote audio track from the native layer.
    `private int` | `nativeRegisterMediaPacketReceiver(long cptr, AgoraMediaPacketReceiver agoraMediaPacketReceiver)` Registers a media packet receiver natively.
    `private int` | `nativeUnregisterMediaPacketReceiver(long cptr, AgoraMediaPacketReceiver agoraMediaPacketReceiver)` Unregisters a media packet receiver natively.
    `int` | `registerMediaPacketReceiver(AgoraMediaPacketReceiver agoraMediaPacketReceiver)` Registers a media packet receiver for this track.
    `int` | `unregisterMediaPacketReceiver(AgoraMediaPacketReceiver agoraMediaPacketReceiver)` Unregisters a media packet receiver from this track.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### cptr

          private long cptr

      Native pointer to the remote audio track resource.

  - ### Constructor Detail

    - #### AgoraRemoteAudioTrack

          AgoraRemoteAudioTrack(long cptr)

      Constructs a remote audio track.
      Parameters:
        `cptr` - Native pointer to the remote audio track object

  - ### Method Detail

    - #### getNativeHandle

          public long getNativeHandle()

      Gets the native handle of the remote audio track.
      Returns:
        The native handle of the remote audio track.

    - #### destroy

          public void destroy()

      Destroys the remote audio track. Ensures that the native resources are released.

    - #### getStatistics

          public RemoteAudioTrackStats getStatistics()

      Retrieves the statistics of the remote audio track.
      Returns:
        Statistics object for the remote audio track

    - #### destroyStatistics

          void destroyStatistics(RemoteAudioTrackStats stats)

      Destroys the provided RemoteAudioTrackStats object.
      Parameters:
        `stats` - The RemoteAudioTrackStats object to be destroyed

    - #### getState

          public int getState()

      Gets the current state of the remote audio track.
      Returns:
        The state of the audio track

    - #### registerMediaPacketReceiver

          public int registerMediaPacketReceiver(AgoraMediaPacketReceiver agoraMediaPacketReceiver)

      Registers a media packet receiver for this track.
      Parameters:
        `agoraMediaPacketReceiver` - Media packet receiver instance
      Returns:
        0 on success, <0 on failure

    - #### unregisterMediaPacketReceiver

          public int unregisterMediaPacketReceiver(AgoraMediaPacketReceiver agoraMediaPacketReceiver)

      Unregisters a media packet receiver from this track.
      Parameters:
        `agoraMediaPacketReceiver` - Media packet receiver instance
      Returns:
        0 on success, <0 on failure

    - #### nativeDestroy

          private void nativeDestroy(long cptr)

      Releases the native remote audio track handle.
      Parameters:
        `cptr` - Native pointer to the audio track

    - #### nativeGetStatistics

          private RemoteAudioTrackStats nativeGetStatistics(long cptr)

      Obtains statistics for the remote audio track from the native layer.
      Parameters:
        `cptr` - Native pointer to the audio track
      Returns:
        Statistics object for the audio track

    - #### nativeDestroyStatistics

          private void nativeDestroyStatistics(long cptr,
                                               RemoteAudioTrackStats stats)

      Releases a statistics object that was created natively.
      Parameters:
        `cptr` - Native pointer to the audio track
        `stats` - Statistics object to destroy

    - #### nativeGetState

          private int nativeGetState(long cptr)

      Retrieves the native state value of the audio track.
      Parameters:
        `cptr` - Native pointer to the audio track
      Returns:
        The state of the audio track

    - #### nativeRegisterMediaPacketReceiver

          private int nativeRegisterMediaPacketReceiver(long cptr,
                                                        AgoraMediaPacketReceiver agoraMediaPacketReceiver)

      Registers a media packet receiver natively.
      Parameters:
        `cptr` - Native pointer to the audio track
        `agoraMediaPacketReceiver` - Media packet receiver instance
      Returns:
        0 on success, <0 on failure

    - #### nativeUnregisterMediaPacketReceiver

          private int nativeUnregisterMediaPacketReceiver(long cptr,
                                                          AgoraMediaPacketReceiver agoraMediaPacketReceiver)

      Unregisters a media packet receiver natively.
      Parameters:
        `cptr` - Native pointer to the audio track
        `agoraMediaPacketReceiver` - Media packet receiver instance
      Returns:
        0 on success, <0 on failure