-
- 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMediaTracker.Companion
-
Method Summary
Modifier and Type Method Description abstract Unitplay(Long position)Called when content is playing or the position has been changed by the user. abstract Unitpause()Called when the content is paused. abstract Unitstop()Called when user has stopped engaging with the content such as closing the content. abstract UnitsetDuration(Long duration)Set the duration in milliseconds of the content. -
-
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.
-
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.
-
-
-
-