Back to Exoplayer

PlaybackSessionManager (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/analytics/PlaybackSessionManager.html

latest9.1 KB
Original Source

Package com.google.android.exoplayer2.analytics

Interface PlaybackSessionManager

  • All Known Implementing Classes:DefaultPlaybackSessionManager

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfacePlaybackSessionManager

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Manager for active playback sessions.

The manager keeps track of the association between window index and/or media period id to session identifier.

Nested Class Summary

Nested Classes | Modifier and Type | Interface | Description | | --- | --- | --- | | static interface | PlaybackSessionManager.Listener | Deprecated.

A listener for session updates. |

Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | boolean | belongsToSession​(AnalyticsListener.EventTime eventTime, String sessionId) | Deprecated.

Returns whether an event time belong to a session. | | void | finishAllSessions​(AnalyticsListener.EventTime eventTime) | Deprecated.

Finishes all existing sessions and calls their respective PlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean) callback. | | String | getActiveSessionId() | Deprecated.

Returns the session identifier of the session that is currently actively playing, or null if there no such session. | | String | getSessionForMediaPeriodId​(Timeline timeline, MediaSource.MediaPeriodId mediaPeriodId) | Deprecated.

Returns the session identifier for the given media period id. | | void | setListener​(PlaybackSessionManager.Listener listener) | Deprecated.

Sets the listener to be notified of session updates. | | void | updateSessions​(AnalyticsListener.EventTime eventTime) | Deprecated.

Updates or creates sessions based on a player AnalyticsListener.EventTime. | | void | updateSessionsWithDiscontinuity​(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason) | Deprecated.

Updates or creates sessions based on a position discontinuity at AnalyticsListener.EventTime. | | void | updateSessionsWithTimelineChange​(AnalyticsListener.EventTime eventTime) | Deprecated.

Updates or creates sessions based on a Timeline change at AnalyticsListener.EventTime. |

Method Detail

- 

setListener

void setListener​([PlaybackSessionManager.Listener](PlaybackSessionManager.Listener.html "interface in com.google.android.exoplayer2.analytics")listener)

Deprecated.

Sets the listener to be notified of session updates. Must be called before the session manager is used. Parameters:listener - The PlaybackSessionManager.Listener to be notified of session updates.

- 

getSessionForMediaPeriodId

[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getSessionForMediaPeriodId​([Timeline](../Timeline.html "class in com.google.android.exoplayer2")timeline,[MediaSource.MediaPeriodId](../source/MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId)

Deprecated.

Returns the session identifier for the given media period id.

Note that this will reserve a new session identifier if it doesn't exist yet, but will not call any PlaybackSessionManager.Listener callbacks.

Parameters:timeline - The timeline, mediaPeriodId is part of.mediaPeriodId - A MediaSource.MediaPeriodId.

- 

belongsToSession

boolean belongsToSession​([AnalyticsListener.EventTime](AnalyticsListener.EventTime.html "class in com.google.android.exoplayer2.analytics")eventTime,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")sessionId)

Deprecated.

Returns whether an event time belong to a session. Parameters:eventTime - The AnalyticsListener.EventTime.sessionId - A session identifier.Returns:Whether the event belongs to the specified session.

- 

updateSessions

void updateSessions​([AnalyticsListener.EventTime](AnalyticsListener.EventTime.html "class in com.google.android.exoplayer2.analytics")eventTime)

Deprecated.

Updates or creates sessions based on a player AnalyticsListener.EventTime.

Call updateSessionsWithTimelineChange(EventTime) or updateSessionsWithDiscontinuity(EventTime, int) if the event is a Timeline change or a position discontinuity respectively.

Parameters:eventTime - The AnalyticsListener.EventTime.

- 

updateSessionsWithTimelineChange

void updateSessionsWithTimelineChange​([AnalyticsListener.EventTime](AnalyticsListener.EventTime.html "class in com.google.android.exoplayer2.analytics")eventTime)

Deprecated.

Updates or creates sessions based on a Timeline change at AnalyticsListener.EventTime.

Should be called instead of updateSessions(EventTime) if a Timeline change occurred.

Parameters:eventTime - The AnalyticsListener.EventTime with the timeline change.

- 

updateSessionsWithDiscontinuity

void updateSessionsWithDiscontinuity​([AnalyticsListener.EventTime](AnalyticsListener.EventTime.html "class in com.google.android.exoplayer2.analytics")eventTime,[@DiscontinuityReason](../Player.DiscontinuityReason.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.Player.DiscontinuityReason int reason)

Deprecated.

Updates or creates sessions based on a position discontinuity at AnalyticsListener.EventTime.

Should be called instead of updateSessions(EventTime) if a position discontinuity occurred.

Parameters:eventTime - The AnalyticsListener.EventTime of the position discontinuity.reason - The Player.DiscontinuityReason.

- 

getActiveSessionId

@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getActiveSessionId()

Deprecated.

Returns the session identifier of the session that is currently actively playing, or null if there no such session.

- 

finishAllSessions

void finishAllSessions​([AnalyticsListener.EventTime](AnalyticsListener.EventTime.html "class in com.google.android.exoplayer2.analytics")eventTime)

Deprecated.

Finishes all existing sessions and calls their respective PlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean) callback. Parameters:eventTime - The event time at which sessions are finished.