Class AnalyticsSession
- All Implemented Interfaces:
- IAnalyticsSession,- PlayerControllerPlugin.Component
- Direct Known Subclasses:
- AnalyticsSessionProxy
IAnalyticsSession which could be enabled or disabled.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInform the session that the ad is clickedfinal voidadError(Ad ad, CastlabsPlayerException exception) Inform the session that an ad error occurred.final voidadPause()Inform the session that the ad is paused.voidInform the session that an ad playback resumed.final voidInform the session that the ad is skipped.final voidInform the session that an ad playback started.final voidadStop()Inform the session that an ad playback stopped.final voidadWillStart(Ad ad) Inform the session that an Ad begins loadingfinal voidDetach the Analytics session from the PlayerController.final booleanReturns true if the session is enabled, otherwise false.final voidonExoPlayerStateChanged(boolean playWhenReady, int playbackState) Lets the Analytics Sessions know of any state changes in ExoPlayer.final voidrelease()Terminate the AnalyticsSession.final voidReport the current player state manually.final voidseekEnd()Inform the session that the seeking has completed.final voidInform the session that the requested seek position of the video playback is processed.final voidseekStart(long newPosition) Inform the session that the new position of the video playback is requested.final voidSend an error manually.voidsetEnabled(boolean enabled) Enable or disable the session.final voidstart(PlayerController playerController, AnalyticsMetaData analyticsMetaData) Start the session on the given controllerfinal voidstop()Stop the session.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.castlabs.android.player.PlayerControllerPlugin.Componentid, onDestroy, onOpenBundle, onOpenState
- 
Constructor Details- 
AnalyticsSessionpublic AnalyticsSession()
 
- 
- 
Method Details- 
startpublic final void start(@NonNull PlayerController playerController, @NonNull AnalyticsMetaData analyticsMetaData) Description copied from interface:IAnalyticsSessionStart the session on the given controller- Specified by:
- startin interface- IAnalyticsSession
- Parameters:
- playerController- The player controller
- analyticsMetaData- The meta-data associated with this session
 
- 
stoppublic final void stop()Description copied from interface:IAnalyticsSessionStop the session.- Specified by:
- stopin interface- IAnalyticsSession
 
- 
adWillStartDescription copied from interface:IAnalyticsSessionInform the session that an Ad begins loading- Specified by:
- adWillStartin interface- IAnalyticsSession
- Parameters:
- ad- The Ad object. Notice that in this level, some properties of the ad such as- Ad.titlemight be null.
 
- 
adStartDescription copied from interface:IAnalyticsSessionInform the session that an ad playback started.- Specified by:
- adStartin interface- IAnalyticsSession
- Parameters:
- ad- The ad metadata. Contains streamType (Either- SdkConsts.AD_EMBEDDEDif the ad is embedded into the content or- SdkConsts.AD_SEPARATEif the ad is played separate from the main content.), playerType (Either- SdkConsts.AD_EMBEDDEDif the ad is using the same player as the main content or- SdkConsts.AD_SEPARATEif the ad is played in a separate player and adPosition The ad position. One of- SdkConsts.AD_POSITION_PREROLL- SdkConsts.AD_POSITION_MIDROLL, or- SdkConsts.AD_POSITION_POSTROLL
 
- 
adStoppublic final void adStop()Description copied from interface:IAnalyticsSessionInform the session that an ad playback stopped.- Specified by:
- adStopin interface- IAnalyticsSession
 
- 
adErrorDescription copied from interface:IAnalyticsSessionInform the session that an ad error occurred.- Specified by:
- adErrorin interface- IAnalyticsSession
- Parameters:
- ad- The ad
- exception- The error's exception
 
- 
adSkippedpublic final void adSkipped()Description copied from interface:IAnalyticsSessionInform the session that the ad is skipped.- Specified by:
- adSkippedin interface- IAnalyticsSession
 
- 
reportPlayerStateDescription copied from interface:IAnalyticsSessionReport the current player state manually. This is used for the cases thatPlayerListener.onStateChanged(PlayerController.State)is called before but we want to report it now, same as switching between playlist items inMultiControllerPlaylist- Specified by:
- reportPlayerStatein interface- IAnalyticsSession
 
- 
sendErrorDescription copied from interface:IAnalyticsSessionSend an error manually. Note that the player integration takes care of playback error occurring during playback. Use this method to send error that happen outside of the playback session.- Specified by:
- sendErrorin interface- IAnalyticsSession
- Parameters:
- code- The error code
- message- The error message
- severity- The severity of the error
 
- 
seekStartpublic final void seekStart(long newPosition) Description copied from interface:IAnalyticsSessionInform the session that the new position of the video playback is requested.- Specified by:
- seekStartin interface- IAnalyticsSession
- Parameters:
- newPosition- the new position in microseconds
 
- 
seekEndpublic final void seekEnd()Description copied from interface:IAnalyticsSessionInform the session that the seeking has completed.Triggered when the player is ready to continue playback by transitioning to either PlayerController.State.PlayingorPlayerController.State.Pausing.- Specified by:
- seekEndin interface- IAnalyticsSession
 
- 
seekProcessedpublic final void seekProcessed()Description copied from interface:IAnalyticsSessionInform the session that the requested seek position of the video playback is processed. This is called right after the player has updated the internal playback position.- Specified by:
- seekProcessedin interface- IAnalyticsSession
 
- 
detachFromControllerpublic final void detachFromController()Description copied from interface:IAnalyticsSessionDetach the Analytics session from the PlayerController. Unregister listeners and remove any references.This method allows to unbind the AnalyticsSession from a PlayerController, to later set it to a new controller and continue with the same analytics session. Should be called by client code after getting the AnalyticsSession via PlayerController.getAnalyticsSession(), and before releasing the PlayerController.You can later re-attach the AnalyticsSession to a PlayerController before openingit with thePlayerController.setAnalyticsSession(AnalyticsSession)method- Specified by:
- detachFromControllerin interface- IAnalyticsSession
 
- 
onExoPlayerStateChangedpublic final void onExoPlayerStateChanged(boolean playWhenReady, int playbackState) Description copied from interface:IAnalyticsSessionLets the Analytics Sessions know of any state changes in ExoPlayer.This method allows any interested Analytics sessions to know of any changes in the ExoPlayer even if it doesn't correspond to any state changes in the PlayerController. - Specified by:
- onExoPlayerStateChangedin interface- IAnalyticsSession
 
- 
releasepublic final void release()Description copied from interface:IAnalyticsSessionTerminate the AnalyticsSession. Although implementation is vendor-specific, this method will terminate any ongoing session as if the player itself had been destroyed. Generally, there's no need to call this manually. Unless you're detaching the session and not reusing it later.- Specified by:
- releasein interface- IAnalyticsSession
 
- 
adPausepublic final void adPause()Description copied from interface:IAnalyticsSessionInform the session that the ad is paused.- Specified by:
- adPausein interface- IAnalyticsSession
 
- 
adResumeDescription copied from interface:IAnalyticsSessionInform the session that an ad playback resumed. This is usually triggered after an adPause.Nevertheless, it is also possible that this event is fired without a preceding adPause. This is the case when re-opening the player from the background with a saved state. - Specified by:
- adResumein interface- IAnalyticsSession
- Parameters:
- ad- the ad that has been resumed
 
- 
adClickDescription copied from interface:IAnalyticsSessionInform the session that the ad is clicked- Specified by:
- adClickin interface- IAnalyticsSession
- Parameters:
- clickthroughUrl- the clickthrough url of the ad
 
- 
getEnabledpublic final boolean getEnabled()Returns true if the session is enabled, otherwise false.- Returns:
- enabled
 
- 
setEnabled@CallSuper public void setEnabled(boolean enabled) Enable or disable the session.- Parameters:
- enabled- the value
 
 
-