Class AnalyticsSessionProxy
- java.lang.Object
-
- com.castlabs.analytics.AnalyticsSessionProxy
-
- All Implemented Interfaces:
AnalyticsSession,PlayerControllerPlugin.Component
public class AnalyticsSessionProxy extends Object implements AnalyticsSession
Proxy implementation of anAnalyticsSessionthat can delegate to a list of session.- Since:
- 3.1.0
-
-
Constructor Summary
Constructors Constructor Description AnalyticsSessionProxy(List<AnalyticsSession> sessions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadError(CastlabsPlayerException exception)Inform the session that an ad error occurred.voidadSkipped()Inform the session that the ad is skipped.voidadStart(Ad ad)Inform the session that an ad playback started.voidadStop()Inform the session that an ad playback stopped.voiddetachFromController()Detach the Analytics session from the PlayerController.List<AnalyticsSession>getSessions()Classid()Returns the class that is used to identify this component when it is registered with the player controller.voidonDestroy(PlayerController playerController)Called when the controller is destroyed.voidonExoPlayerStateChanged(boolean playWhenReady, int playbackState)Lets the Analytics Sessions know of any state changes in ExoPlayer.voidonOpenBundle(PlayerController playerController, Bundle bundle)Called when the player controller is opened with a bundle.voidonOpenState(PlayerController playerController, PlayerConfig playerConfig)Called when the player controller is opened with a config.voidrelease()Terminate the AnalyticsSession.voidseekEnd()Inform the session that the seeking has completed.voidseekProcessed()Inform the session that the requested seek position of the video playback is processed.voidseekStart(long newPosition)Inform the session that the new position of the video playback is requested.voidsendError(String code, String message, int severity)Send an error manually.voidstart(PlayerController playerController, AnalyticsMetaData analyticsMetaData)Start the session on the given controllervoidstop()Stop the session.
-
-
-
Constructor Detail
-
AnalyticsSessionProxy
public AnalyticsSessionProxy(@Nullable List<AnalyticsSession> sessions)
-
-
Method Detail
-
getSessions
@Nullable public List<AnalyticsSession> getSessions()
-
start
public void start(@NonNull PlayerController playerController, @NonNull AnalyticsMetaData analyticsMetaData)Description copied from interface:AnalyticsSessionStart the session on the given controller- Specified by:
startin interfaceAnalyticsSession- Parameters:
playerController- The player controlleranalyticsMetaData- The meta-data associated with this session
-
stop
public void stop()
Description copied from interface:AnalyticsSessionStop the session.- Specified by:
stopin interfaceAnalyticsSession
-
adStart
public void adStart(Ad ad)
Description copied from interface:AnalyticsSessionInform the session that an ad playback started.- Specified by:
adStartin interfaceAnalyticsSession- Parameters:
ad- The ad metadata. Contains streamType (EitherSdkConsts.AD_EMBEDDEDif the ad is embedded into the content orSdkConsts.AD_SEPARATEif the ad is played separate from the main content.), playerType (EitherSdkConsts.AD_EMBEDDEDif the ad is using the same player as the main content orSdkConsts.AD_SEPARATEif the ad is played in a separate player and adPosition The ad position. One ofSdkConsts.AD_POSITION_PREROLLSdkConsts.AD_POSITION_MIDROLL, orSdkConsts.AD_POSITION_POSTROLL
-
adStop
public void adStop()
Description copied from interface:AnalyticsSessionInform the session that an ad playback stopped.- Specified by:
adStopin interfaceAnalyticsSession
-
adError
public void adError(CastlabsPlayerException exception)
Description copied from interface:AnalyticsSessionInform the session that an ad error occurred.- Specified by:
adErrorin interfaceAnalyticsSession- Parameters:
exception- The error's exception
-
adSkipped
public void adSkipped()
Description copied from interface:AnalyticsSessionInform the session that the ad is skipped.- Specified by:
adSkippedin interfaceAnalyticsSession
-
sendError
public void sendError(String code, String message, int severity)
Description copied from interface:AnalyticsSessionSend 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 interfaceAnalyticsSession- Parameters:
code- The error codemessage- The error messageseverity- The severity of the error
-
seekStart
public void seekStart(long newPosition)
Description copied from interface:AnalyticsSessionInform the session that the new position of the video playback is requested.- Specified by:
seekStartin interfaceAnalyticsSession- Parameters:
newPosition- the new position in microseconds
-
seekEnd
public void seekEnd()
Description copied from interface:AnalyticsSessionInform 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 interfaceAnalyticsSession
-
seekProcessed
public void seekProcessed()
Description copied from interface:AnalyticsSessionInform 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 interfaceAnalyticsSession
-
detachFromController
public void detachFromController()
Description copied from interface:AnalyticsSessionDetach 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 interfaceAnalyticsSession
-
release
public void release()
Description copied from interface:AnalyticsSessionTerminate 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 interfaceAnalyticsSession
-
onExoPlayerStateChanged
public void onExoPlayerStateChanged(boolean playWhenReady, int playbackState)Description copied from interface:AnalyticsSessionLets 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 interfaceAnalyticsSession
-
id
@NonNull public Class id()
Description copied from interface:PlayerControllerPlugin.ComponentReturns the class that is used to identify this component when it is registered with the player controller. This is what you need to pass toPlayerController.getComponent(Class)to get the registered instance of this component.- Specified by:
idin interfacePlayerControllerPlugin.Component- Returns:
- The class that identifies this component.
-
onDestroy
public void onDestroy(@NonNull PlayerController playerController)Description copied from interface:PlayerControllerPlugin.ComponentCalled when the controller is destroyed. Implementation must use this to unregister any listeners that were attached to the controller before.- Specified by:
onDestroyin interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controller
-
onOpenBundle
public void onOpenBundle(@NonNull PlayerController playerController, @NonNull Bundle bundle)Description copied from interface:PlayerControllerPlugin.ComponentCalled when the player controller is opened with a bundle. Implementations can use this to extract or modify bundle data.- Specified by:
onOpenBundlein interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controllerbundle- The bundle
-
onOpenState
public void onOpenState(PlayerController playerController, PlayerConfig playerConfig)
Description copied from interface:PlayerControllerPlugin.ComponentCalled when the player controller is opened with a config. Implementations can use this to extract or modify config data.- Specified by:
onOpenStatein interfacePlayerControllerPlugin.Component- Parameters:
playerController- The player controllerplayerConfig- The playback state
-
-