Listen to playback events
Learn how to observe playback state changes, buffering, seek events, and more using the PlaybackListener interface.
All callbacks are invoked on the main thread.
Attach a playback listener
Callback details
onPlayerReady(durationMs)fires once per media item when the player reaches READY for the first time—not on every rebuffer or seek.onTimeUpdate(...)fires periodically during active playback (default ~500ms) and stops automatically when paused, ended, or when no listeners remain.onSeekStart/onSeekEndtriggers for both user scrubs and programmaticseekTocalls.onBufferingStart/onBufferingEndfires on buffering transitions. Use these to show or hide a loading spinner.onCompleted()fires when reaching the end of media. Ifloop = true, this callback still fires before the video repeats.
Remove the listener
Remove the listener when it’s no longer needed to avoid leaks: