ContentConsumptionTracker

class ContentConsumptionTracker(player: AdComposedPlayer, clock: MonotonicClock = MonotonicClock.System, toleranceMultiplier: Double = DEFAULT_TOLERANCE_MULTIPLIER) : Player.Listener

Tracks valid main content consumption and publishes AdFrequencyEvent domain events.

Holds a WeakReference to Player to avoid retaining player or view hierarchies. Consumption is counted only during active content playback:

Position deltas from onProgressUpdate are validated against elapsed monotonic time using Player.playbackRateFactor, but the value applied is the elapsed monotonic time, so playback speed cannot accelerate or slow the required watched-content interval.

Stopping one playback and starting another preserves the global AFC counter: stop never resets consumption.

Constructors

Link copied to clipboard
constructor(player: AdComposedPlayer, clock: MonotonicClock = MonotonicClock.System, toleranceMultiplier: Double = DEFAULT_TOLERANCE_MULTIPLIER)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
Link copied to clipboard
open fun onAudioVolumeChanged(volume: Float)
Link copied to clipboard
Link copied to clipboard
open fun onError(error: Error)
Link copied to clipboard
open fun onEventReceived(streamTimelineEvent: StreamTimelineEvent, suggestedAction: Action, streamTimelineMetadata: StreamTimelineMetadata?)
Link copied to clipboard
open fun onMediaPlaylistItemTransition(mediaPlaylistItemTransitionInfo: MediaPlaylistItemTransitionInfo)
Link copied to clipboard
Link copied to clipboard
open fun onPlayerAction(playerAction: PlayerAction)
Link copied to clipboard
Link copied to clipboard
open fun onPlayerViewAvailable(playerView: FrameLayout)
Link copied to clipboard
open override fun onProgressUpdate(currentTimeInWindowMs: Long, currentWindowDurationMs: Long)
Link copied to clipboard
open fun onRateChanged(speed: Float, pitch: Float)
Link copied to clipboard
open fun onRawPlayerReady()
Link copied to clipboard
open override fun onStateChange(playbackState: PlaybackState, bufferingState: BufferingState, seekingState: SeekingState)
Link copied to clipboard
open override fun onStreamEnded()
Link copied to clipboard
Link copied to clipboard
open fun onVideoSizeChanged(videoSize: VideoSize)
Link copied to clipboard
Link copied to clipboard
fun start()

Registers the listener on the player.

Link copied to clipboard
fun stop()

Unregisters the listener and clears the baseline. Consumed state is preserved.