OGPlayer
The ogplayer playback engine.
Create instances with OGPlayer.Builder. All methods must be called from the application main thread. Call release when done.
Types
Properties
Content positions of upcoming (unplayed) ad breaks in milliseconds — the cue markers a scrub bar renders. Postrolls report the content duration. Empty when no ad schedule is loaded.
Audio tracks (languages/audio descriptions) of the current media.
Buffered position in the current media, in milliseconds.
The cast connector this player was built with, if any.
Friendly name of the connected cast device, null when not connected.
The currently loaded media item, if any.
Index of the playing playlist item, or -1 without a playlist.
Current playback position in milliseconds.
Duration of the current media in milliseconds, or 0 when unknown.
Whether the current media item has a trick-play thumbnail track.
SDK-internal: whether the ad that is on screen is paused. Read by the chrome to seed its ad transport from the player's state (a view that attaches mid-break — an Activity recreate — never saw the events).
SDK-internal: whether the ads provider's own UI has a dialog open (IMA's "About this ad").
True when a valid, unexpired license key bound to this app was set. SDK-internal: read by the UI to gate the unlicensed-build watermark.
Whether an ad is currently playing (content is paused underneath).
The upcoming playlist item, or null at the end / without a playlist.
Current playback speed (1.0 = normal).
The active playlist; empty when a single item was loaded.
Amount applied by seekBackward, in milliseconds.
Amount applied by seekForward, in milliseconds.
Id of the current analytics session — a fresh UUID per load, stamped on every AnalyticsEvent of that load. Null before the first load.
Current high-level playback state.
Current caption rendering style.
Subtitle/caption tracks of the current media (embedded + sideloaded).
Video renditions of the current media, highest first.
How the volume slider behaves; see VolumeControlMode. Default VolumeControlMode.DEVICE — the hardware volume buttons move the slider.
Functions
Feeds a view-layer analytics event (AnalyticsEvent.FullscreenChanged, AnalyticsEvent.OrientationChanged, AnalyticsEvent.PictureInPictureChanged) into this player's analytics stream, session-stamped like every other event. Called by the SDK's own views — not host-app API.
SDK-internal: hands the remote's focus to the ads provider's own UI (IMA's skip button / "About this ad") — see com.ogplayer.api.ads.AdsProvider.focusUi.
Loads the trick-play thumbnail for positionMs, or null when the item has no thumbnail track or loading fails. Safe to call while scrubbing; sprite sheets are cached internally.
Loads a playlist: items play in order, each item auto-advancing to the next when it completes (its postrolls included). The UI module's "Up next" countdown card renders during the configurable lead window before each transition; hosts that hide it get silent advancing. PlaybackListener.onPlaylistItemChanged fires on every transition, including the initial item.
Seeks backward by the configured increment (default 10s).
Seeks forward by the configured increment (default 10s).
Seeks to positionMs within the current media.
Seeks to the live edge (or default position) of the current media.
Selects the audio track with the given AudioTrack.id.
Selects the text track with the given TextTrack.id, or disables subtitles when null.
Pins playback to the rendition with the given VideoQuality.id, or returns to adaptive selection (Auto) when null.
SDK-internal: the view group ads render into (set by OGPlayerView). Accepts a Media3 AdViewProvider or a plain ViewGroup.
Switches the buffering role of a player built with Builder.setStandbyBufferProfile — the vertical-feed pool keeps preloaded players on OGBufferRole.STANDBY and promotes the visible one to OGBufferRole.ACTIVE. No-op when no standby profile was configured.
Enables or disables single-item looping. While looping the player never reaches the ENDED state — it seeks back to the start and keeps playing.
Sets the playback speed; speed must be positive.
SDK-internal: the ViewGroup slot-ad providers render into (set by OGPlayerView). Distinct from setAdViewGroup, which feeds the Media3/IMA ad view path.
Sets the caption rendering style, applied immediately.
Skips to the next playlist item immediately (the "Up next" card's tap action). No-op without a next item.
Skips to the previous playlist item immediately (the TV chrome's "previous" button, the remote's previous-track key). No-op on the first item or without a playlist.