Interface AnalyticsSession

    • Method Detail

      • start

        void start​(@NonNull
                   PlayerController playerController,
                   @NonNull
                   AnalyticsMetaData analyticsMetaData)
        Start the session on the given controller
        Parameters:
        playerController - The player controller
        analyticsMetaData - The meta-data associated with this session
      • stop

        void stop()
        Stop the session.
      • adStop

        void adStop()
        Inform the session that an ad playback stopped.
      • adError

        void adError​(CastlabsPlayerException exception)
        Inform the session that an ad error occurred.
        Parameters:
        exception - The error's exception
      • adSkipped

        void adSkipped()
        Inform the session that the ad is skipped.
      • sendError

        void sendError​(String code,
                       String message,
                       int severity)
        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.
        Parameters:
        code - The error code
        message - The error message
        severity - The severity of the error
      • seekStart

        void seekStart​(long newPosition)
        Inform the session that the new position of the video playback is requested.
        Parameters:
        newPosition - the new position in microseconds
      • seekProcessed

        void seekProcessed()
        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.
      • detachFromController

        void detachFromController()
        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

      • onExoPlayerStateChanged

        void onExoPlayerStateChanged​(boolean playWhenReady,
                                     int playbackState)
        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.

      • release

        void release()
        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.