# Player.Listener

# Player.Listener

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/common/Player.java+class:androidx.media3.common.Player.Listener)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/media3/common/Player.Listener "View this page in Java")


```
interface Player.Listener
```

<br />

Known direct subclasses  
[AnalyticsCollector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/AnalyticsCollector), [ExoPlayerTestRunner](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner), [WearUnsuitableOutputPlaybackSuppressionResolverListener](https://developer.android.com/reference/kotlin/androidx/media3/ui/WearUnsuitableOutputPlaybackSuppressionResolverListener)  

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AnalyticsCollector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/AnalyticsCollector)                                                          | Interface for data collectors that forward analytics events to [AnalyticsListeners](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/AnalyticsListener).                                                                                                                                                                                                              |
| [ExoPlayerTestRunner](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner)                                                                 | Helper class to run an ExoPlayer test.                                                                                                                                                                                                                                                                                                                                                                  |
| [WearUnsuitableOutputPlaybackSuppressionResolverListener](https://developer.android.com/reference/kotlin/androidx/media3/ui/WearUnsuitableOutputPlaybackSuppressionResolverListener) | A [Player.Listener](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener) that launches a system dialog in response to [PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT()) to allow the user to connect a suitable audio output. |

Known indirect subclasses  
[DefaultAnalyticsCollector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector)  

|-------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DefaultAnalyticsCollector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/DefaultAnalyticsCollector) | Data collector that forwards analytics events to [AnalyticsListeners](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/AnalyticsListener). |

*** ** * ** ***

Listener for changes in a [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player).

All methods have no-op default implementations to allow selective overrides.

If the return value of a [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player) getter changes due to a change in [command availability](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)), the corresponding listener method(s) will be invoked. If the return value of a [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player) getter does not change because the corresponding command is [not available](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)), the corresponding listener method will not be invoked.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onAudioAttributesChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAudioAttributesChanged(androidx.media3.common.AudioAttributes))`(audioAttributes: `[AudioAttributes](https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes)`!)` Called when the value of [getAudioAttributes](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getAudioAttributes()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [onAudioSessionIdChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAudioSessionIdChanged(int))`(audioSessionId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the audio session ID changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onAvailableCommandsChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands))`(availableCommands: `[Player.Commands](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands)`!)` Called when the value returned from [isCommandAvailable](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isCommandAvailable(int)) changes for at least one [Command](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Command).                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup))`(cueGroup: `[CueGroup](https://developer.android.com/reference/kotlin/androidx/media3/common/text/CueGroup)`!)` Called when the value of [getCurrentCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentCues()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) ~~[onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(java.util.List<androidx.media3.common.text.Cue>))~~`(cues: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Cue](https://developer.android.com/reference/kotlin/androidx/media3/common/text/Cue)`!>!)` **This function is deprecated.** Use [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)) instead. <br />                                                                                                                                                            |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDeviceInfoChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onDeviceInfoChanged(androidx.media3.common.DeviceInfo))`(deviceInfo: `[DeviceInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/DeviceInfo)`!)` Called when the device information changes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onDeviceVolumeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onDeviceVolumeChanged(int,boolean))`(volume: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, muted: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Called when the value of [getDeviceVolume](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getDeviceVolume()) or [isDeviceMuted](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isDeviceMuted()) changes.                                                                                                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events))`(player: `[Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player)`!, events: `[Player.Events](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events)`!)` Called when one or more player states changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onIsLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean))`(isLoading: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Called when the player starts or stops loading the source.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onIsPlayingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsPlayingChanged(boolean))`(isPlaying: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Called when the value of [isPlaying](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isPlaying()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) ~~[onLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onLoadingChanged(boolean))~~`(isLoading: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` **This function is deprecated.** Use [onIsLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)) instead. <br />                                                                                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onMaxSeekToPreviousPositionChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMaxSeekToPreviousPositionChanged(long))`(maxSeekToPreviousPositionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called when the value of [getMaxSeekToPreviousPosition](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMaxSeekToPreviousPosition()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onMediaItemTransition](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int))`(` ` mediaItem: `[MediaItem](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem)`?,` ` @`[Player.MediaItemTransitionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.MediaItemTransitionReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Called when playback transitions to a media item or starts repeating a media item according to the current [repeat mode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()).                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onMediaMetadataChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMediaMetadataChanged(androidx.media3.common.MediaMetadata))`(mediaMetadata: `[MediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata)`!)` Called when the value of [getMediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMediaMetadata()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) [onMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMetadata(androidx.media3.common.Metadata))`(metadata: `[Metadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata)`!)` Called when there is metadata associated with the current playback time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlayWhenReadyChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int))`(` ` playWhenReady: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` @`[Player.PlayWhenReadyChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlayWhenReadyChangeReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Called when the value returned from [getPlayWhenReady](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayWhenReady()) changes.                                                                                                                                                                                                                                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlaybackParametersChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackParametersChanged(androidx.media3.common.PlaybackParameters))`(playbackParameters: `[PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!)` Called when the value of [getPlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackParameters()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int))`(@`[Player.State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State)` playbackState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the value returned from [getPlaybackState](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackState()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlaybackSuppressionReasonChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackSuppressionReasonChanged(int))`(` ` @`[Player.PlaybackSuppressionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlaybackSuppressionReason)` playbackSuppressionReason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Called when the value returned from [getPlaybackSuppressionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackSuppressionReason()) changes.                                                                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlayerError](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException))`(error: `[PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException)`!)` Called when an error occurs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlayerErrorChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerErrorChanged(androidx.media3.common.PlaybackException))`(error: `[PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException)`?)` Called when the [PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException) returned by [getPlayerError](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayerError()) changes.                                                                                                                                                                                                                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) ~~[onPlayerStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerStateChanged(boolean,int))~~`(` ` playWhenReady: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` @`[Player.State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State)` playbackState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` **This function is deprecated.** Use [onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)) and [onPlayWhenReadyChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)) instead. <br /> |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPlaylistMetadataChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaylistMetadataChanged(androidx.media3.common.MediaMetadata))`(mediaMetadata: `[MediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata)`!)` Called when the value of [getPlaylistMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaylistMetadata()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[UnstableApi](https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi) ~~[onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(int))~~`(@`[Player.DiscontinuityReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.** Use [onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)) instead. <br />                                                                                                                                                            |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int))`(` ` oldPosition: `[Player.PositionInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo)`!,` ` newPosition: `[Player.PositionInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo)`!,` ` @`[Player.DiscontinuityReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Called when a position discontinuity occurs.                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onRenderedFirstFrame](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onRenderedFirstFrame())`()` Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onRepeatModeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onRepeatModeChanged(int))`(@`[Player.RepeatMode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode)` repeatMode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the value of [getRepeatMode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSeekBackIncrementChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSeekBackIncrementChanged(long))`(seekBackIncrementMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called when the value of [getSeekBackIncrement](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekBackIncrement()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSeekForwardIncrementChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSeekForwardIncrementChanged(long))`(seekForwardIncrementMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called when the value of [getSeekForwardIncrement](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekForwardIncrement()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onShuffleModeEnabledChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onShuffleModeEnabledChanged(boolean))`(shuffleModeEnabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Called when the value of [getShuffleModeEnabled](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getShuffleModeEnabled()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSkipSilenceEnabledChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSkipSilenceEnabledChanged(boolean))`(skipSilenceEnabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Called when skipping silences is enabled or disabled in the audio stream.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onSurfaceSizeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSurfaceSizeChanged(int,int))`(width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called each time there's a change in the size of the surface onto which the video is being rendered.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onTimelineChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int))`(` ` timeline: `[Timeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline)`!,` ` @`[Player.TimelineChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Called when the value of [getCurrentTimeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()) changes.                                                                                                                                                                                                                                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onTrackSelectionParametersChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTrackSelectionParametersChanged(androidx.media3.common.TrackSelectionParameters))`(parameters: `[TrackSelectionParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/TrackSelectionParameters)`!)` Called when the value returned from [getTrackSelectionParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getTrackSelectionParameters()) changes.                                                                                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onTracksChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTracksChanged(androidx.media3.common.Tracks))`(tracks: `[Tracks](https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks)`!)` Called when the value of [getCurrentTracks](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTracks()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onVideoSizeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onVideoSizeChanged(androidx.media3.common.VideoSize))`(videoSize: `[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize)`!)` Called each time when [getVideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVideoSize()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onVolumeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onVolumeChanged(float))`(volume: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Called when the value of [getVolume](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVolume()) changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

## Public functions

### onAudioAttributesChanged

```
fun onAudioAttributesChanged(audioAttributes: AudioAttributes!): Unit
```

Called when the value of [getAudioAttributes](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getAudioAttributes()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                           Parameters                                                           |
|--------------------------------------------------------------------------------------------------------------------------------|-----------------------|
| `audioAttributes: `[AudioAttributes](https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes)`!` | The audio attributes. |

### onAudioSessionIdChanged

```
@UnstableApi
fun onAudioSessionIdChanged(audioSessionId: Int): Unit
```

Called when the audio session ID changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|-----------------------|
| `audioSessionId: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The audio session ID. |

### onAvailableCommandsChanged

```
fun onAvailableCommandsChanged(availableCommands: Player.Commands!): Unit
```

Called when the value returned from [isCommandAvailable](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isCommandAvailable(int)) changes for at least one [Command](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Command).

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                            Parameters                                                            |
|----------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| `availableCommands: `[Player.Commands](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands)`!` | The available [Commands](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands). |

### onCues

```
fun onCues(cueGroup: CueGroup!): Unit
```

Called when the value of [getCurrentCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentCues()) changes.

Both this method and [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(java.util.List<androidx.media3.common.text.Cue>)) are called when there is a change in the cues. You should only implement one or the other.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

### onCues

```
@UnstableApi
fun [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(java.util.List<androidx.media3.common.text.Cue>))(cues: (Mutable)List<Cue!>!): Unit
```
| **This function is deprecated.**   
|
| Use [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)) instead.

Called when the value of [getCurrentCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentCues()) changes.

Both this method and [onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)) are called when there is a change in the cues. You should only implement one or the other.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

### onDeviceInfoChanged

```
fun onDeviceInfoChanged(deviceInfo: DeviceInfo!): Unit
```

Called when the device information changes

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                   Parameters                                                    |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| `deviceInfo: `[DeviceInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/DeviceInfo)`!` | The new [DeviceInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/DeviceInfo). |

### onDeviceVolumeChanged

```
fun onDeviceVolumeChanged(volume: Int, muted: Boolean): Unit
```

Called when the value of [getDeviceVolume](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getDeviceVolume()) or [isDeviceMuted](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isDeviceMuted()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `volume: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | The new device volume, with 0 being silence and 1 being unity gain. |
| `muted: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the device is muted.                                        |

### onEvents

```
fun onEvents(player: Player!, events: Player.Events!): Unit
```

Called when one or more player states changed.

State changes and events that happen within one [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration are reported together and only after all individual callbacks were triggered.

Listeners should prefer this method over individual callbacks in the following cases:

- They intend to trigger the same logic for multiple events (e.g. when updating a UI for both [onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)) and [onPlayWhenReadyChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int))).
- They need access to the [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player) object to trigger further events (e.g. to call [seekTo](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekTo(long)) after a [onMediaItemTransition](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int))).
- They intend to use multiple state values together or in combination with [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player) getter methods. For example using [getCurrentMediaItemIndex](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentMediaItemIndex()) with the `
  timeline` provided in [onTimelineChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)) is only safe from within this method.
- They are interested in events that logically happened together (e.g [onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)) to [STATE_BUFFERING](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_BUFFERING()) because of [onMediaItemTransition](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMediaItemTransition(androidx.media3.common.MediaItem,int))).

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `player: `[Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player)`!`               | The [Player](https://developer.android.com/reference/kotlin/androidx/media3/common/Player) whose state changed. Use the getters to obtain the latest states.               |
| `events: `[Player.Events](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events)`!` | The [Events](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events) that happened in this iteration, indicating which player states changed. |

### onIsLoadingChanged

```
fun onIsLoadingChanged(isLoading: Boolean): Unit
```

Called when the player starts or stops loading the source.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|-----------------------------------------------|
| `isLoading: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the source is currently being loaded. |

### onIsPlayingChanged

```
fun onIsPlayingChanged(isPlaying: Boolean): Unit
```

Called when the value of [isPlaying](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isPlaying()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|--------------------------------|
| `isPlaying: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the player is playing. |

### onLoadingChanged

```
@UnstableApi
fun [onLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onLoadingChanged(boolean))(isLoading: Boolean): Unit
```
| **This function is deprecated.**   
|
Use [onIsLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)) instead.  

### onMaxSeekToPreviousPositionChanged

```
fun onMaxSeekToPreviousPositionChanged(maxSeekToPreviousPositionMs: Long): Unit
```

Called when the value of [getMaxSeekToPreviousPosition](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMaxSeekToPreviousPosition()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `maxSeekToPreviousPositionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The maximum position for which [seekToPrevious](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekToPrevious()) seeks to the previous position, in milliseconds. |

### onMediaItemTransition

```
fun onMediaItemTransition(
    mediaItem: MediaItem?,
    @Player.MediaItemTransitionReason reason: Int
): Unit
```

Called when playback transitions to a media item or starts repeating a media item according to the current [repeat mode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()).

Note that this callback is also called when the value of [getCurrentTimeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()) becomes non-empty or empty.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                             Parameters                                                                                                              |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `mediaItem: `[MediaItem](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem)`?`                                                                                                                        | The [MediaItem](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem). May be null if the playlist becomes empty. |
| `@`[Player.MediaItemTransitionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.MediaItemTransitionReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The reason for the transition.                                                                                                               |

### onMediaMetadataChanged

```
fun onMediaMetadataChanged(mediaMetadata: MediaMetadata!): Unit
```

Called when the value of [getMediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMediaMetadata()) changes.

This method may be called multiple times in quick succession.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                        Parameters                                                        |
|--------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| `mediaMetadata: `[MediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata)`!` | The combined [MediaMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata). |

### onMetadata

```
@UnstableApi
fun onMetadata(metadata: Metadata!): Unit
```

Called when there is metadata associated with the current playback time.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                Parameters                                                 |
|-----------------------------------------------------------------------------------------------------------|---------------|
| `metadata: `[Metadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata)`!` | The metadata. |

### onPlayWhenReadyChanged

```
fun onPlayWhenReadyChanged(
    playWhenReady: Boolean,
    @Player.PlayWhenReadyChangeReason reason: Int
): Unit
```

Called when the value returned from [getPlayWhenReady](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayWhenReady()) changes.

The current `playWhenReady` value may be re-reported if the `reason` for this value changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                             Parameters                                                                                                              |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `playWhenReady: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                | Whether playback will proceed when ready.                                                                                                               |
| `@`[Player.PlayWhenReadyChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlayWhenReadyChangeReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The [PlayWhenReadyChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlayWhenReadyChangeReason) for the change. |

### onPlaybackParametersChanged

```
fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters!): Unit
```

Called when the value of [getPlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackParameters()) changes. The playback parameters may change due to a call to [setPlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.PlaybackParameters)), or the player itself may change them (for example, if audio playback switches to passthrough or offload mode, where speed adjustment is no longer possible).

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                               Parameters                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| `playbackParameters: `[PlaybackParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters)`!` | The playback parameters. |

### onPlaybackStateChanged

```
fun onPlaybackStateChanged(@Player.State playbackState: Int): Unit
```

Called when the value returned from [getPlaybackState](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackState()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                             Parameters                                                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| `@`[Player.State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State)` playbackState: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The new playback [State](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State). |

### onPlaybackSuppressionReasonChanged

```
fun onPlaybackSuppressionReasonChanged(
    @Player.PlaybackSuppressionReason playbackSuppressionReason: Int
): Unit
```

Called when the value returned from [getPlaybackSuppressionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackSuppressionReason()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                                       Parameters                                                                                                                       |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[Player.PlaybackSuppressionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlaybackSuppressionReason)` playbackSuppressionReason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The current [PlaybackSuppressionReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlaybackSuppressionReason). |

### onPlayerError

```
fun onPlayerError(error: PlaybackException!): Unit
```

Called when an error occurs. The playback state will transition to [STATE_IDLE](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_IDLE()) immediately after this method is called. The player instance can still be used, and [release](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#release()) must still be called on the player should it no longer be required.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.

Implementations of Player may pass an instance of a subclass of [PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException) to this method in order to include more information about the error.  

|                                                        Parameters                                                        |
|--------------------------------------------------------------------------------------------------------------------------|------------|
| `error: `[PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException)`!` | The error. |

### onPlayerErrorChanged

```
fun onPlayerErrorChanged(error: PlaybackException?): Unit
```

Called when the [PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException) returned by [getPlayerError](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayerError()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.

Implementations of Player may pass an instance of a subclass of [PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException) to this method in order to include more information about the error.  

|                                                        Parameters                                                        |
|--------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| `error: `[PlaybackException](https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException)`?` | The new error, or null if the error is being cleared. |

### onPlayerStateChanged

```
@UnstableApi
fun [onPlayerStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerStateChanged(boolean,int))(
    playWhenReady: Boolean,
    @Player.State playbackState: Int
): Unit
```
| **This function is deprecated.**   
|
Use [onPlaybackStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)) and [onPlayWhenReadyChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)) instead.  

### onPlaylistMetadataChanged

```
fun onPlaylistMetadataChanged(mediaMetadata: MediaMetadata!): Unit
```

Called when the value of [getPlaylistMetadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaylistMetadata()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

### onPositionDiscontinuity

```
@UnstableApi
fun [onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(int))(@Player.DiscontinuityReason reason: Int): Unit
```
| **This function is deprecated.**   
|
Use [onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)) instead.  

### onPositionDiscontinuity

```
fun onPositionDiscontinuity(
    oldPosition: Player.PositionInfo!,
    newPosition: Player.PositionInfo!,
    @Player.DiscontinuityReason reason: Int
): Unit
```

Called when a position discontinuity occurs.

A position discontinuity occurs when the playing period changes, the playback position jumps within the period currently being played, or when the playing period has been skipped or removed.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                       Parameters                                                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `oldPosition: `[Player.PositionInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo)`!`                                                                                      | The position before the discontinuity.                                                                                                                         |
| `newPosition: `[Player.PositionInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo)`!`                                                                                      | The position after the discontinuity.                                                                                                                          |
| `@`[Player.DiscontinuityReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The [DiscontinuityReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason) responsible for the discontinuity. |

### onRenderedFirstFrame

```
fun onRenderedFirstFrame(): Unit
```

Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

### onRepeatModeChanged

```
fun onRepeatModeChanged(@Player.RepeatMode repeatMode: Int): Unit
```

Called when the value of [getRepeatMode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                Parameters                                                                                                 |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| `@`[Player.RepeatMode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode)` repeatMode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The [RepeatMode](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode) used for playback. |

### onSeekBackIncrementChanged

```
fun onSeekBackIncrementChanged(seekBackIncrementMs: Long): Unit
```

Called when the value of [getSeekBackIncrement](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekBackIncrement()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                              Parameters                                              |
|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `seekBackIncrementMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The [seekBack](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekBack()) increment, in milliseconds. |

### onSeekForwardIncrementChanged

```
fun onSeekForwardIncrementChanged(seekForwardIncrementMs: Long): Unit
```

Called when the value of [getSeekForwardIncrement](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekForwardIncrement()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                               Parameters                                                |
|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `seekForwardIncrementMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The [seekForward](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#seekForward()) increment, in milliseconds. |

### onShuffleModeEnabledChanged

```
fun onShuffleModeEnabledChanged(shuffleModeEnabled: Boolean): Unit
```

Called when the value of [getShuffleModeEnabled](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getShuffleModeEnabled()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                Parameters                                                 |
|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| `shuffleModeEnabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether shuffling of [media items](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem) is enabled. |

### onSkipSilenceEnabledChanged

```
fun onSkipSilenceEnabledChanged(skipSilenceEnabled: Boolean): Unit
```

Called when skipping silences is enabled or disabled in the audio stream.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                Parameters                                                 |
|-----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `skipSilenceEnabled: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether skipping silences in the audio stream is enabled. |

### onSurfaceSizeChanged

```
fun onSurfaceSizeChanged(width: Int, height: Int): Unit
```

Called each time there's a change in the size of the surface onto which the video is being rendered.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                      Parameters                                       |
|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | The surface width in pixels. May be [LENGTH_UNSET](https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()) if unknown, or 0 if the video is not rendered onto a surface.  |
| `height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The surface height in pixels. May be [LENGTH_UNSET](https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()) if unknown, or 0 if the video is not rendered onto a surface. |

### onTimelineChanged

```
fun onTimelineChanged(
    timeline: Timeline!,
    @Player.TimelineChangeReason reason: Int
): Unit
```

Called when the value of [getCurrentTimeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()) changes.

Note that the current [MediaItem](https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem) or playback position may change as a result of a timeline change. If playback can't continue smoothly because of this timeline change, a separate [onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)) callback will be triggered.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                                                        Parameters                                                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `timeline: `[Timeline](https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline)`!`                                                                                                                 | The latest timeline. Never null, but may be empty.                                                                                                                  |
| `@`[Player.TimelineChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason)` reason: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The [TimelineChangeReason](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason) responsible for this timeline change. |

### onTrackSelectionParametersChanged

```
fun onTrackSelectionParametersChanged(parameters: TrackSelectionParameters!): Unit
```

Called when the value returned from [getTrackSelectionParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getTrackSelectionParameters()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                                 Parameters                                                                  |
|---------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `parameters: `[TrackSelectionParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/TrackSelectionParameters)`!` | The new [TrackSelectionParameters](https://developer.android.com/reference/kotlin/androidx/media3/common/TrackSelectionParameters). |

### onTracksChanged

```
fun onTracksChanged(tracks: Tracks!): Unit
```

Called when the value of [getCurrentTracks](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTracks()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                             Parameters                                              |
|-----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| `tracks: `[Tracks](https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks)`!` | The available tracks information. Never null, but may be of length zero. |

### onVideoSizeChanged

```
fun onVideoSizeChanged(videoSize: VideoSize!): Unit
```

Called each time when [getVideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVideoSize()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|----------------------------|
| `videoSize: `[VideoSize](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize)`!` | The new size of the video. |

### onVolumeChanged

```
fun onVolumeChanged(volume: Float): Unit
```

Called when the value of [getVolume](https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVolume()) changes.

[onEvents](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)) will also be called to report this event along with other events that happen in the same [Looper](https://developer.android.com/reference/android/os/Looper.html) message queue iteration.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| `volume: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The new volume, with 0 being silence and 1 being unity gain. |