io.agora.rtc

## Interface IAudioFrameObserver

- All Known Implementing Classes:
    AgoraAudioFrameObserverWrapper

      public interface IAudioFrameObserver

  Observer interface for audio frame events.

- - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default int` | `getObservedAudioFramePosition()` Gets the observed audio frame position.
    `default int` | `onEarMonitoringAudioFrame(AgoraLocalUser agoraLocalUser, AudioFrame frame)` Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer.
    `default int` | `onMixedAudioFrame(AgoraLocalUser agoraLocalUser, java.lang.String channelId, AudioFrame frame)` Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer.
    `default int` | `onPlaybackAudioFrame(AgoraLocalUser agoraLocalUser, java.lang.String channelId, AudioFrame frame)` Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer.
    `default int` | `onPlaybackAudioFrameBeforeMixing(AgoraLocalUser agoraLocalUser, java.lang.String channelId, java.lang.String userId, AudioFrame frame, VadProcessResult vadResult)` Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer.
    `default int` | `onRecordAudioFrame(AgoraLocalUser agoraLocalUser, java.lang.String channelId, AudioFrame frame)` Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer.

- - ### Method Detail

    - #### onRecordAudioFrame

          default int onRecordAudioFrame(AgoraLocalUser agoraLocalUser,
                                         java.lang.String channelId,
                                         AudioFrame frame)

      Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer. Be sure to extract the byte array value in the callback synchronously and then transfer it to the asynchronous thread for processing. You can refer to `Utils.getBytes(ByteBuffer)`.
      Parameters:
        `agoraLocalUser` - the local user
        `channelId` - the channel id
        `frame` - the audio frame
      Returns:
        0/1, the return value currently has no practical significance

    - #### onPlaybackAudioFrame

          default int onPlaybackAudioFrame(AgoraLocalUser agoraLocalUser,
                                           java.lang.String channelId,
                                           AudioFrame frame)

      Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer. Be sure to extract the byte array value in the callback synchronously and then transfer it to the asynchronous thread for processing. You can refer to `Utils.getBytes(ByteBuffer)`.
      Parameters:
        `agoraLocalUser` - the local user
        `channelId` - the channel id
        `frame` - the audio frame
      Returns:
        0/1, the return value currently has no practical significance

    - #### onMixedAudioFrame

          default int onMixedAudioFrame(AgoraLocalUser agoraLocalUser,
                                        java.lang.String channelId,
                                        AudioFrame frame)

      Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer. Be sure to extract the byte array value in the callback synchronously and then transfer it to the asynchronous thread for processing. You can refer to `Utils.getBytes(ByteBuffer)`.
      Parameters:
        `agoraLocalUser` - the local user
        `channelId` - the channel id
        `frame` - the audio frame
      Returns:
        0/1, the return value currently has no practical significance

    - #### onEarMonitoringAudioFrame

          default int onEarMonitoringAudioFrame(AgoraLocalUser agoraLocalUser,
                                                AudioFrame frame)

      Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer. Be sure to extract the byte array value in the callback synchronously and then transfer it to the asynchronous thread for processing. You can refer to `Utils.getBytes(ByteBuffer)`.
      Parameters:
        `agoraLocalUser` - the local user
        `frame` - the audio frame
      Returns:
        0/1, the return value currently has no practical significance

    - #### onPlaybackAudioFrameBeforeMixing

          default int onPlaybackAudioFrameBeforeMixing(AgoraLocalUser agoraLocalUser,
                                                       java.lang.String channelId,
                                                       java.lang.String userId,
                                                       AudioFrame frame,
                                                       VadProcessResult vadResult)

      Note: To improve data transmission efficiency, the buffer of the frame object is a DirectByteBuffer. Be sure to extract the byte array value in the callback synchronously and then transfer it to the asynchronous thread for processing. You can refer to `Utils.getBytes(ByteBuffer)`.
      Parameters:
        `agoraLocalUser` - the local user
        `channelId` - the channel id
        `userId` - the user id
        `frame` - the audio frame
        `vadResult` - the vad result
      Returns:
        0/1, the return value currently has no practical significance

    - #### getObservedAudioFramePosition

          default int getObservedAudioFramePosition()

      Gets the observed audio frame position.
      Returns:
        Audio frame position