DefaultPlaybackSessionManagerpublic interface PlaybackSessionManager
The manager keeps track of the association between window index and/or media period id to session identifier.
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
PlaybackSessionManager.Listener |
A listener for session updates.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
belongsToSession(AnalyticsListener.EventTime eventTime,
String sessionId) |
Returns whether an event time belong to a session.
|
void |
finishAllSessions(AnalyticsListener.EventTime eventTime) |
Finishes all existing sessions and calls their respective
PlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean) callback. |
String |
getSessionForMediaPeriodId(Timeline timeline,
MediaSource.MediaPeriodId mediaPeriodId) |
Returns the session identifier for the given media period id.
|
void |
setListener(PlaybackSessionManager.Listener listener) |
Sets the listener to be notified of session updates.
|
void |
updateSessions(AnalyticsListener.EventTime eventTime) |
Updates or creates sessions based on a player
AnalyticsListener.EventTime. |
void |
updateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime,
int reason) |
Updates or creates sessions based on a position discontinuity at
AnalyticsListener.EventTime. |
void |
updateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime) |
Updates or creates sessions based on a
Timeline change at AnalyticsListener.EventTime. |
void setListener(PlaybackSessionManager.Listener listener)
listener - The PlaybackSessionManager.Listener to be notified of session updates.String getSessionForMediaPeriodId(Timeline timeline, MediaSource.MediaPeriodId mediaPeriodId)
Note that this will reserve a new session identifier if it doesn't exist yet, but will not
call any PlaybackSessionManager.Listener callbacks.
timeline - The timeline, mediaPeriodId is part of.mediaPeriodId - A MediaSource.MediaPeriodId.boolean belongsToSession(AnalyticsListener.EventTime eventTime, String sessionId)
eventTime - The AnalyticsListener.EventTime.sessionId - A session identifier.void updateSessions(AnalyticsListener.EventTime eventTime)
AnalyticsListener.EventTime.
Call updateSessionsWithTimelineChange(EventTime) or updateSessionsWithDiscontinuity(EventTime, int) if the event is a Timeline change or
a position discontinuity respectively.
eventTime - The AnalyticsListener.EventTime.void updateSessionsWithTimelineChange(AnalyticsListener.EventTime eventTime)
Timeline change at AnalyticsListener.EventTime.
Should be called instead of updateSessions(EventTime) if a Timeline change
occurred.
eventTime - The AnalyticsListener.EventTime with the timeline change.void updateSessionsWithDiscontinuity(AnalyticsListener.EventTime eventTime, @DiscontinuityReason int reason)
AnalyticsListener.EventTime.
Should be called instead of updateSessions(EventTime) if a position discontinuity
occurred.
eventTime - The AnalyticsListener.EventTime of the position discontinuity.reason - The Player.DiscontinuityReason.void finishAllSessions(AnalyticsListener.EventTime eventTime)
PlaybackSessionManager.Listener.onSessionFinished(EventTime, String, boolean) callback.eventTime - The event time at which sessions are finished.