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.DefaultPlaybackSessionManager
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 aDEFAULT_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 respectivePlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean)
callback.String
getActiveSessionId()
Deprecated.Returns the session identifier of the session that is currently actively playing, ornull
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 playerAnalyticsListener.EventTime
.void
updateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime, @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.Updates or creates sessions based on a position discontinuity atAnalyticsListener.EventTime
.void
updateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime)
Deprecated.Updates or creates sessions based on aTimeline
change atAnalyticsListener.EventTime
.
-
-
-
Constructor Detail
-
DefaultPlaybackSessionManager
public DefaultPlaybackSessionManager()
Deprecated.Creates session manager with aDEFAULT_SESSION_ID_GENERATOR
to generate session ids.
-
-
Method Detail
-
setListener
public void setListener(PlaybackSessionManager.Listener 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 interfacePlaybackSessionManager
- Parameters:
listener
- ThePlaybackSessionManager.Listener
to be notified of session updates.
-
getSessionForMediaPeriodId
public String getSessionForMediaPeriodId(Timeline timeline, MediaSource.MediaPeriodId 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 interfacePlaybackSessionManager
- Parameters:
timeline
- The timeline,mediaPeriodId
is part of.mediaPeriodId
- AMediaSource.MediaPeriodId
.
-
belongsToSession
public boolean belongsToSession(AnalyticsListener.EventTime eventTime, String sessionId)
Deprecated.Description copied from interface:PlaybackSessionManager
Returns whether an event time belong to a session.- Specified by:
belongsToSession
in 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:PlaybackSessionManager
Updates or creates sessions based on a playerAnalyticsListener.EventTime
.Call
PlaybackSessionManager.updateSessionsWithTimelineChange(EventTime)
orPlaybackSessionManager.updateSessionsWithDiscontinuity(EventTime, int)
if the event is aTimeline
change or a position discontinuity respectively.- Specified by:
updateSessions
in interfacePlaybackSessionManager
- Parameters:
eventTime
- TheAnalyticsListener.EventTime
.
-
updateSessionsWithTimelineChange
public void updateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime)
Deprecated.Description copied from interface:PlaybackSessionManager
Updates or creates sessions based on aTimeline
change atAnalyticsListener.EventTime
.Should be called instead of
PlaybackSessionManager.updateSessions(EventTime)
if aTimeline
change occurred.- Specified by:
updateSessionsWithTimelineChange
in interfacePlaybackSessionManager
- Parameters:
eventTime
- TheAnalyticsListener.EventTime
with the timeline change.
-
updateSessionsWithDiscontinuity
public void updateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime, @DiscontinuityReason @com.google.android.exoplayer2.Player.DiscontinuityReason int reason)
Deprecated.Description copied from interface:PlaybackSessionManager
Updates 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:
updateSessionsWithDiscontinuity
in interfacePlaybackSessionManager
- Parameters:
eventTime
- TheAnalyticsListener.EventTime
of the position discontinuity.reason
- ThePlayer.DiscontinuityReason
.
-
getActiveSessionId
@Nullable public String getActiveSessionId()
Deprecated.Description copied from interface:PlaybackSessionManager
Returns the session identifier of the session that is currently actively playing, ornull
if there no such session.- Specified by:
getActiveSessionId
in interfacePlaybackSessionManager
-
finishAllSessions
public void finishAllSessions(AnalyticsListener.EventTime eventTime)
Deprecated.Description copied from interface:PlaybackSessionManager
Finishes all existing sessions and calls their respectivePlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean)
callback.- Specified by:
finishAllSessions
in interfacePlaybackSessionManager
- Parameters:
eventTime
- The event time at which sessions are finished.
-
-