AudioPlayer
already ships PCM sampling —
isAudioSamplingSupported
,
setAudioSamplingEnabled(enabled)
, and the
audioSampleUpdate
event.
AudioPlaylist
has none of it: its entire event map is
playlistStatusUpdate
and
trackChanged
.
The ask: mirror those onto
AudioPlaylist
, emitting for whichever track is
current (
currentIndex
is already tracked and surfaced).
Use case — a hands-free voice assistant. TTS clips play through
AudioPlaylist
because one queue gives synthesis/playback overlap, ordering, and a single
stop/kill switch in one place. The UI has a presence indicator that should pulse
with the assistant's actual voice, but with no sampling on the playlist it has
to run off a synthetic timer instead. The alternatives are adding a native
audio dependency, or moving playback to individual
AudioPlayer
s and rebuilding
the queue/skip machinery — neither is proportionate to needing an amplitude
number.
It looks small on both platforms (read against 57.0.4):
  • Android:
    AudioPlayer
    sources its samples from
    Visualizer(ref.audioSessionId)
in
createVisualizer()
.
AudioPlaylist
extends the same
BaseAudioPlayer
and
so has the same
ref.audioSessionId
, and
Visualizer
binds to the audio
session rather than the media item — so track changes need no special handling.
Lifting
samplingEnabled
+
createVisualizer()
+
sendAudioSampleUpdate()
into
BaseAudioPlayer
would give both classes the feature at once.
  • iOS:
    AudioTapProcessor
    is initialised with an
    AVPlayer
    , and
    AudioPlaylist
is a
SharedRef<AVQueuePlayer>
— already an
AVPlayer
. The tap attaches to
player.currentItem
's audio mix, so the only additional piece is re-installing
it on track change, which the playlist already observes.
Happy to put up a PR if that would be welcome.