Package 

Interface MediaTracker

  • All Implemented Interfaces:
    com.permutive.android.EventTracker

    
    public interface MediaTracker
     implements EventTracker
                        

    Tracks events based on interactions with media content. Engagement with content is tracked based on the time spent consuming the content and what percentage of the content is consumed if the content has a finite duration.

    Upon stopping the content a completion event will be sent.

    The MediaTracker is an EventTracker and can track custom events which will be associated with the current media content.

    The media tracker tracks an initial view event on creation and starts in a paused state. Engagement will not be tracked until play is called.

    For media content of an unknown length use the MediaTracker.UNKNOWN_DURATION constant as the duration.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit play(Long position) Called when content is playing or the position has been changed by the user.
      abstract Unit pause() Called when the content is paused.
      abstract Unit stop() Called when user has stopped engaging with the content such as closing the content.
      abstract Unit setDuration(Long duration) Set the duration in milliseconds of the content.
      • Methods inherited from class com.permutive.android.EventTracker

        track, track
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • play

         abstract Unit play(Long position)

        Called when content is playing or the position has been changed by the user. Engagement tracking will be started.

        Can be called multiple times in a row if the user is scrubbing through the content.

        Parameters:
        position - The time position the content has started from or been moved to in milliseconds, pass in null to play from the same position and for infinite or unknown duration content such as live streams.
      • pause

         abstract Unit pause()

        Called when the content is paused. Engagement tracking will be stopped.

      • stop

         abstract Unit stop()

        Called when user has stopped engaging with the content such as closing the content. This will send the media completion event.

      • setDuration

         abstract Unit setDuration(Long duration)

        Set the duration in milliseconds of the content. This needs to be set before the video is stopped to be reflected in the completion event.