Interface CefriumAudioHandler


public interface CefriumAudioHandler
Raw PCM tap of the page's audio, mirroring CEF's CefAudioHandler.

Opt-in and exclusive: registering an audio handler REDIRECTS the page's audio to this callback — it no longer plays through the device speakers. Use it for capture/analysis, not alongside normal playback. Set with CefriumBrowser.setAudioHandler(CefriumAudioHandler); pass null to disable and restore normal playback.

onAudioStreamPacket(ByteBuffer, int, long) is called on a dedicated audio thread; the others on the UI thread.

  • Method Details

    • onAudioStreamStarted

      default void onAudioStreamStarted(int channels, int sampleRate)
      The audio stream started.
      Parameters:
      channels - Number of channels (interleaved in each packet).
      sampleRate - Sample rate in Hz.
    • onAudioStreamPacket

      default void onAudioStreamPacket(ByteBuffer data, int frames, long pts)
      A PCM packet. data holds frames * channels 32-bit floats, interleaved. The buffer is only valid for the duration of this call.
      Parameters:
      data - Interleaved float32 samples.
      frames - Number of frames in this packet.
      pts - Presentation timestamp (ms).
    • onAudioStreamStopped

      default void onAudioStreamStopped()
      The audio stream stopped.
    • onAudioStreamError

      default void onAudioStreamError(String message)
      An audio stream error occurred (the stream is stopped).