Back to Exoplayer

DefaultPlaybackSessionManager (ExoPlayer library)

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

latest13.1 KB
Original Source

Package com.google.android.exoplayer2.analytics

Class DefaultPlaybackSessionManager

  • java.lang.Object

    • com.google.android.exoplayer2.analytics.DefaultPlaybackSessionManager
  • All Implemented Interfaces:PlaybackSessionManager


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultPlaybackSessionManagerextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[PlaybackSessionManager](PlaybackSessionManager.html "interface in com.google.android.exoplayer2.analytics")

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.

Default PlaybackSessionManager which instantiates a new session for each window in the timeline and also for each ad within the windows.

By default, sessions are identified by Base64-encoded, URL-safe, random strings.

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.analytics.PlaybackSessionManager

PlaybackSessionManager.Listener

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static Supplier<String> | DEFAULT_SESSION_ID_GENERATOR | Deprecated.

Default generator for unique session ids that are random, Based64-encoded and URL-safe. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | DefaultPlaybackSessionManager() | Deprecated.

Creates session manager with a DEFAULT_SESSION_ID_GENERATOR to generate session ids. | | DefaultPlaybackSessionManager​(Supplier<String> sessionIdGenerator) | Deprecated.

Creates session manager. |

Method Summary

All Methods Instance Methods Concrete 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. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

DEFAULT_SESSION_ID_GENERATOR

public static final[Supplier](https://guava.dev/releases/31.1-android/api/docs/com/google/common/base/Supplier.html?is-external=true "class or interface in com.google.common.base")<[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")> DEFAULT_SESSION_ID_GENERATOR

Deprecated.

Default generator for unique session ids that are random, Based64-encoded and URL-safe.

Constructor Detail

- 

DefaultPlaybackSessionManager

public DefaultPlaybackSessionManager()

Deprecated.

Creates session manager with a DEFAULT_SESSION_ID_GENERATOR to generate session ids.

- 

DefaultPlaybackSessionManager

public DefaultPlaybackSessionManager​([Supplier](https://guava.dev/releases/31.1-android/api/docs/com/google/common/base/Supplier.html?is-external=true "class or interface in com.google.common.base")<[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")> sessionIdGenerator)

Deprecated.

Creates session manager. Parameters:sessionIdGenerator - A generator for new session ids. All generated session ids must be unique.

Method Detail

- 

setListener

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

Deprecated.

Description copied from interface: PlaybackSessionManager

Sets the listener to be notified of session updates. Must be called before the session manager is used. Specified by:setListener in interface PlaybackSessionManagerParameters:listener - The PlaybackSessionManager.Listener to be notified of session updates.

- 

getSessionForMediaPeriodId

public[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.

Description copied from interface: PlaybackSessionManager

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.

Specified by:getSessionForMediaPeriodId in interface PlaybackSessionManagerParameters:timeline - The timeline, mediaPeriodId is part of.mediaPeriodId - A MediaSource.MediaPeriodId.

- 

belongsToSession

public 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.

Description copied from interface: PlaybackSessionManager

Returns whether an event time belong to a session. Specified by:belongsToSession in interface PlaybackSessionManagerParameters:eventTime - The AnalyticsListener.EventTime.sessionId - A session identifier.Returns:Whether the event belongs to the specified session.

- 

updateSessions

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

Deprecated.

Description copied from interface: PlaybackSessionManager

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

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

Specified by:updateSessions in interface PlaybackSessionManagerParameters:eventTime - The AnalyticsListener.EventTime.

- 

updateSessionsWithTimelineChange

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

Deprecated.

Description copied from interface: PlaybackSessionManager

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

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

Specified by:updateSessionsWithTimelineChange in interface PlaybackSessionManagerParameters:eventTime - The AnalyticsListener.EventTime with the timeline change.

- 

updateSessionsWithDiscontinuity

public 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.

Description copied from interface: PlaybackSessionManager

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

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

Specified by:updateSessionsWithDiscontinuity in interface PlaybackSessionManagerParameters:eventTime - The AnalyticsListener.EventTime of the position discontinuity.reason - The Player.DiscontinuityReason.

- 

getActiveSessionId

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

Deprecated.

Description copied from interface: PlaybackSessionManager

Returns the session identifier of the session that is currently actively playing, or null if there no such session. Specified by:getActiveSessionId in interface PlaybackSessionManager

- 

finishAllSessions

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

Deprecated.

Description copied from interface: PlaybackSessionManager

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