Class AnalyticsSession

java.lang.Object
com.castlabs.analytics.AnalyticsSession
All Implemented Interfaces:
IAnalyticsSession, PlayerControllerPlugin.Component
Direct Known Subclasses:
AnalyticsSessionProxy

public abstract class AnalyticsSession extends Object implements IAnalyticsSession
Implementation of IAnalyticsSession which could be enabled or disabled.
  • Constructor Details

    • AnalyticsSession

      public AnalyticsSession()
  • Method Details

    • start

      public final void start(@NonNull PlayerController playerController, @NonNull AnalyticsMetaData analyticsMetaData)
      Description copied from interface: IAnalyticsSession
      Start the session on the given controller
      Specified by:
      start in interface IAnalyticsSession
      Parameters:
      playerController - The player controller
      analyticsMetaData - The meta-data associated with this session
    • stop

      public final void stop()
      Description copied from interface: IAnalyticsSession
      Stop the session.
      Specified by:
      stop in interface IAnalyticsSession
    • adWillStart

      public final void adWillStart(Ad ad)
      Description copied from interface: IAnalyticsSession
      Inform the session that an Ad begins loading
      Specified by:
      adWillStart in interface IAnalyticsSession
      Parameters:
      ad - The Ad object. Notice that in this level, some properties of the ad such as Ad.title might be null.
    • adStart

      public final void adStart(Ad ad)
      Description copied from interface: IAnalyticsSession
      Inform the session that an ad playback started.
      Specified by:
      adStart in interface IAnalyticsSession
      Parameters:
      ad - The ad metadata. Contains streamType (Either SdkConsts.AD_EMBEDDED if the ad is embedded into the content or SdkConsts.AD_SEPARATE if the ad is played separate from the main content.), playerType (Either SdkConsts.AD_EMBEDDED if the ad is using the same player as the main content or SdkConsts.AD_SEPARATE if 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
    • adStop

      public final void adStop()
      Description copied from interface: IAnalyticsSession
      Inform the session that an ad playback stopped.
      Specified by:
      adStop in interface IAnalyticsSession
    • adError

      public final void adError(Ad ad, CastlabsPlayerException exception)
      Description copied from interface: IAnalyticsSession
      Inform the session that an ad error occurred.
      Specified by:
      adError in interface IAnalyticsSession
      Parameters:
      ad - The ad
      exception - The error's exception
    • adSkipped

      public final void adSkipped()
      Description copied from interface: IAnalyticsSession
      Inform the session that the ad is skipped.
      Specified by:
      adSkipped in interface IAnalyticsSession
    • reportPlayerState

      public final void reportPlayerState(PlayerController.State state)
      Description copied from interface: IAnalyticsSession
      Report the current player state manually. This is used for the cases that PlayerListener.onStateChanged(PlayerController.State) is called before but we want to report it now, same as switching between playlist items in MultiControllerPlaylist
      Specified by:
      reportPlayerState in interface IAnalyticsSession
    • sendError

      public final void sendError(String code, String message, int severity)
      Description copied from interface: IAnalyticsSession
      Send 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:
      sendError in interface IAnalyticsSession
      Parameters:
      code - The error code
      message - The error message
      severity - The severity of the error
    • seekStart

      public final void seekStart(long newPosition)
      Description copied from interface: IAnalyticsSession
      Inform the session that the new position of the video playback is requested.
      Specified by:
      seekStart in interface IAnalyticsSession
      Parameters:
      newPosition - the new position in microseconds
    • seekEnd

      public final void seekEnd()
      Description copied from interface: IAnalyticsSession
      Inform the session that the seeking has completed.

      Triggered when the player is ready to continue playback by transitioning to either PlayerController.State.Playing or PlayerController.State.Pausing.

      Specified by:
      seekEnd in interface IAnalyticsSession
    • seekProcessed

      public final void seekProcessed()
      Description copied from interface: IAnalyticsSession
      Inform 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:
      seekProcessed in interface IAnalyticsSession
    • detachFromController

      public final void detachFromController()
      Description copied from interface: IAnalyticsSession
      Detach 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 opening it with the PlayerController.setAnalyticsSession(AnalyticsSession) method

      Specified by:
      detachFromController in interface IAnalyticsSession
    • onExoPlayerStateChanged

      public final void onExoPlayerStateChanged(boolean playWhenReady, int playbackState)
      Description copied from interface: IAnalyticsSession
      Lets 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:
      onExoPlayerStateChanged in interface IAnalyticsSession
    • release

      public final void release()
      Description copied from interface: IAnalyticsSession
      Terminate 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:
      release in interface IAnalyticsSession
    • adPause

      public final void adPause()
      Description copied from interface: IAnalyticsSession
      Inform the session that the ad is paused.
      Specified by:
      adPause in interface IAnalyticsSession
    • adResume

      public void adResume(Ad ad)
      Description copied from interface: IAnalyticsSession
      Inform 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:
      adResume in interface IAnalyticsSession
      Parameters:
      ad - the ad that has been resumed
    • adClick

      public void adClick(String clickthroughUrl)
      Description copied from interface: IAnalyticsSession
      Inform the session that the ad is clicked
      Specified by:
      adClick in interface IAnalyticsSession
      Parameters:
      clickthroughUrl - the clickthrough url of the ad
    • getEnabled

      public 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