Skip to content

Analytics & events

OGPlayer emits events on three surfaces, and all three are identical across Android, iOS and web — same names, same fields, same timing. This page is the complete inventory.

PlaybackListener — the app-facing callbacks

Section titled “PlaybackListener — the app-facing callbacks”

Drive your UI and app logic from these (all optional):

CallbackFieldsWhen
onStateChangedstateIDLEBUFFERINGREADYENDED
onIsPlayingChangedisPlayingactual playing/not-playing flips
onPlayfirst start of the loaded item only
onPause / onResumeexplicit pauses only — stalls and ad-break handoffs are silent
onProgresspositionMs, bufferedMs, durationMssteady tick, 250 ms default (configurable)
onSeekStartedfromMs, toMsseek begins
onSeekCompletedpositionMsseek lands
onLiveEdgeChangedatLiveEdgeviewer drifts behind / catches up to live
onDrmSessionRenewedreasona license quietly renewed mid-session
onPlaybackCompletedcontent truly finished — waits for postrolls
onErrorOGPlayerErrorterminal errors (stable codes)
onCastStateChangedstateAndroid · Chromecast connection: NO_DEVICES / NOT_CONNECTED / CONNECTING / CONNECTED

On live streams, onProgress reports the position inside the DVR window and the window length as the duration.

One listener, eleven typed events, identical string formatting on every platform — feed them to your pipeline as-is:

EventFieldsWhen
Play / Pausetransport changes (explicit; stalls are silent)
SeekfromMs, toMsuser or API seeks
BufferStart / BufferEndrebuffering window
BitrateChangedbitrate, width, height, frameRateABR switches
DroppedFramescount, elapsedMsrender drops in the window
QualitySnapshotpositionMs, bufferedMs, bandwidthEstimateBps, droppedFramesTotalevery 10 s while playing
DrmKeysLoadedlicense acquired
Errorthe OGPlayerErrorterminal errors
Completecontent finished
player.addAnalyticsListener { event -> pipeline.track(event.toString()) }

Everything about ads lives here — the analytics stream carries no ad events by design, so the two feeds stay cleanly separated:

CallbackFieldsWhen
onAdBreakStartedbreakType, totalAdsa PREROLL / MIDROLL / POSTROLL break begins
onAdStartedAdInfo (adId, pod position, duration, skippability…)each ad begins
onAdProgressad, positionMs, durationMssteady tick during an ad (drives the countdown)
onAdPaused / onAdResumedadviewer pauses/resumes the ad
onAdSkippedadviewer skipped
onAdCompletedadad finished
onAdBreakCompletedbreakTypethe break ended (its cue marker is removed)
onAdSkippableStateChangedad, isSkippable, skipOffsetMsan ad becomes skippable (slot providers)
onAdErrorOGAdError (code, phase, message)ad problems — never fatal to content

VMAP cue points are exposed separately via adCuePositionsMs and drawn as markers on the scrubber.