Class DefaultPlaybackSessionManager
- java.lang.Object
-
- com.google.android.exoplayer2.analytics.DefaultPlaybackSessionManager
-
- All Implemented Interfaces:
PlaybackSessionManager
@Deprecated public final class DefaultPlaybackSessionManager extends Object implements PlaybackSessionManager
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.DefaultPlaybackSessionManagerwhich 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_GENERATORDeprecated.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 aDEFAULT_SESSION_ID_GENERATORto 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 booleanbelongsToSession(AnalyticsListener.EventTime eventTime, String sessionId)Deprecated.Returns whether an event time belong to a session.voidfinishAllSessions(AnalyticsListener.EventTime eventTime)Deprecated.Finishes all existing sessions and calls their respectivePlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean)callback.StringgetActiveSessionId()Deprecated.Returns the session identifier of the session that is currently actively playing, ornullif there no such session.StringgetSessionForMediaPeriodId(Timeline timeline, MediaSource.MediaPeriodId mediaPeriodId)Deprecated.Returns the session identifier for the given media period id.voidsetListener(PlaybackSessionManager.Listener listener)Deprecated.Sets the listener to be notified of session updates.voidupdateSessions(AnalyticsListener.EventTime eventTime)Deprecated.Updates or creates sessions based on a playerAnalyticsListener.EventTime.voidupdateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)Deprecated.Updates or creates sessions based on a position discontinuity atAnalyticsListener.EventTime.voidupdateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime)Deprecated.Updates or creates sessions based on aTimelinechange atAnalyticsListener.EventTime.
-
-
-
Constructor Detail
-
DefaultPlaybackSessionManager
public DefaultPlaybackSessionManager()
Deprecated.Creates session manager with aDEFAULT_SESSION_ID_GENERATORto generate session ids.
-
-
Method Detail
-
setListener
public void setListener(PlaybackSessionManager.Listener listener)
Deprecated.Description copied from interface:PlaybackSessionManagerSets the listener to be notified of session updates. Must be called before the session manager is used.- Specified by:
setListenerin interfacePlaybackSessionManager- Parameters:
listener- ThePlaybackSessionManager.Listenerto be notified of session updates.
-
getSessionForMediaPeriodId
public String getSessionForMediaPeriodId(Timeline timeline, MediaSource.MediaPeriodId mediaPeriodId)
Deprecated.Description copied from interface:PlaybackSessionManagerReturns 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.Listenercallbacks.- Specified by:
getSessionForMediaPeriodIdin interfacePlaybackSessionManager- Parameters:
timeline- The timeline,mediaPeriodIdis part of.mediaPeriodId- AMediaSource.MediaPeriodId.
-
belongsToSession
public boolean belongsToSession(AnalyticsListener.EventTime eventTime, String sessionId)
Deprecated.Description copied from interface:PlaybackSessionManagerReturns whether an event time belong to a session.- Specified by:
belongsToSessionin interfacePlaybackSessionManager- Parameters:
eventTime- TheAnalyticsListener.EventTime.sessionId- A session identifier.- Returns:
- Whether the event belongs to the specified session.
-
updateSessions
public void updateSessions(AnalyticsListener.EventTime eventTime)
Deprecated.Description copied from interface:PlaybackSessionManagerUpdates or creates sessions based on a playerAnalyticsListener.EventTime.Call
PlaybackSessionManager.updateSessionsWithTimelineChange(EventTime)orPlaybackSessionManager.updateSessionsWithDiscontinuity(EventTime, int)if the event is aTimelinechange or a position discontinuity respectively.- Specified by:
updateSessionsin interfacePlaybackSessionManager- Parameters:
eventTime- TheAnalyticsListener.EventTime.
-
updateSessionsWithTimelineChange
public void updateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime)
Deprecated.Description copied from interface:PlaybackSessionManagerUpdates or creates sessions based on aTimelinechange atAnalyticsListener.EventTime.Should be called instead of
PlaybackSessionManager.updateSessions(EventTime)if aTimelinechange occurred.- Specified by:
updateSessionsWithTimelineChangein interfacePlaybackSessionManager- Parameters:
eventTime- TheAnalyticsListener.EventTimewith the timeline change.
-
updateSessionsWithDiscontinuity
public void updateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime, @DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.Description copied from interface:PlaybackSessionManagerUpdates or creates sessions based on a position discontinuity atAnalyticsListener.EventTime.Should be called instead of
PlaybackSessionManager.updateSessions(EventTime)if a position discontinuity occurred.- Specified by:
updateSessionsWithDiscontinuityin interfacePlaybackSessionManager- Parameters:
eventTime- TheAnalyticsListener.EventTimeof the position discontinuity.reason- ThePlayer.DiscontinuityReason.
-
getActiveSessionId
@Nullable public String getActiveSessionId()
Deprecated.Description copied from interface:PlaybackSessionManagerReturns the session identifier of the session that is currently actively playing, ornullif there no such session.- Specified by:
getActiveSessionIdin interfacePlaybackSessionManager
-
finishAllSessions
public void finishAllSessions(AnalyticsListener.EventTime eventTime)
Deprecated.Description copied from interface:PlaybackSessionManagerFinishes all existing sessions and calls their respectivePlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean)callback.- Specified by:
finishAllSessionsin interfacePlaybackSessionManager- Parameters:
eventTime- The event time at which sessions are finished.
-
-