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 Summary
Modifier and TypeMethodDescriptiondefault voidonAudioStreamError(String message) An audio stream error occurred (the stream is stopped).default voidonAudioStreamPacket(ByteBuffer data, int frames, long pts) A PCM packet.default voidonAudioStreamStarted(int channels, int sampleRate) The audio stream started.default voidThe audio stream stopped.
-
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
A PCM packet.dataholdsframes * channels32-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
An audio stream error occurred (the stream is stopped).
-