Package-level declarations

Types

Link copied to clipboard
class ActivityFullscreenHandler @JvmOverloads constructor(activity: Activity, lockLandscape: Boolean = true, onFullscreenChanged: (isFullscreen: Boolean) -> Unit? = null) : FullscreenHandler

Ready-made FullscreenHandler for the common case: hides/shows the system bars edge-to-edge and, with lockLandscape, drives screen orientation.

Link copied to clipboard

Ready-made PipHandler for the common case: drives the activity's picture-in-picture parameters from the player state OGPlayerView feeds it, auto-enters PiP when the user leaves the app (see OGPlayerView's autoEnterPipOnBackground), and exposes one play/pause remote action on the PiP window.

Link copied to clipboard
class CustomAction(@DrawableRes val iconRes: Int, val contentDescription: String? = null, val onClick: () -> Unit)

A host-supplied icon button rendered inline in the player's top-end control row, to the LEFT of the Cast button — icon-only by design (no labels). Custom actions are part of the control chrome: they appear and hide with the controls and are suppressed during ad breaks. Up to 8 per player via OGUiConfig.Builder.setCustomActions.

Link copied to clipboard

Implemented by the host app to enter/exit fullscreen presentation (orientation, system bars, layout). The player view only toggles state and renders the fullscreen button when a handler is provided.

Link copied to clipboard
data class OGControlColors(val foreground: Color = Color.White, val foregroundMuted: Color = Color.White.copy(alpha = 0.70f), val foregroundFaint: Color = Color.White.copy(alpha = 0.38f), val trackPlayed: Color = Color.White, val trackBuffered: Color = Color.White.copy(alpha = 0.38f), val trackRemaining: Color = Color.White.copy(alpha = 0.22f), val thumb: Color = Color.White, val thumbHalo: Color = Color.White.copy(alpha = 0.20f), val pressed: Color = Color.White.copy(alpha = 0.12f), val liveEdge: Color = Color(0xFFF2453E), val liveBehind: Color = Color.White.copy(alpha = 0.60f), val adAccent: Color = Color(0xFFF6C445), val menuSurface: Color = Color(0xF017181A), val menuSelected: Color = Color.White.copy(alpha = 0.10f), val menuBorder: Color = Color.White.copy(alpha = 0.10f), val chipSurface: Color = Color.Black.copy(alpha = 0.55f))

Colour tokens for the built-in player controls. All defaults derive from pure white or pure black so the system survives any host theme; override individual tokens via OGUiConfig.Builder.setControlColors.

Link copied to clipboard
data class OGControlDimens(val trackHeight: Dp = 3.dp, val trackHeightActive: Dp = 5.dp, val thumbSize: Dp = 12.dp, val thumbSizeActive: Dp = 18.dp, val thumbHaloSize: Dp = 34.dp, val scrubTouchHeight: Dp = 48.dp, val touchTargetMin: Dp = 48.dp, val iconSize: Dp = 24.dp, val playButtonSize: Dp = 56.dp, val playGlyphSize: Dp = 28.dp, val seekButtonSize: Dp = 48.dp, val seekGlyphSize: Dp = 24.dp, val clusterGap: Dp = 20.dp, val bottomBarHeight: Dp = 48.dp, val edgeInset: Dp = 12.dp, val bottomScrimHeight: Dp = 140.dp, val topScrimHeight: Dp = 96.dp, val menuMinWidth: Dp = 224.dp, val menuMaxWidth: Dp = 320.dp, val menuItemHeight: Dp = 48.dp, val menuCorner: Dp = 14.dp, val chipHeight: Dp = 24.dp, val adCueMarkerSize: Dp = 4.dp)
Link copied to clipboard

How the built-in chrome is driven — set with OGUiConfig.Builder.setInputMode.

Link copied to clipboard
data class OGStrings(val play: String = "Play", val pause: String = "Pause", val replay: String = "Replay", val seekForward: String = "Seek forward {seconds} seconds", val seekBackward: String = "Seek back {seconds} seconds", val next: String = "Next", val previous: String = "Previous", val volume: String = "Volume", val mute: String = "Mute", val unmute: String = "Unmute", val enterFullscreen: String = "Enter fullscreen", val exitFullscreen: String = "Exit fullscreen", val seekBar: String = "Seek", val customAction: String = "Custom action {n}", val subtitles: String = "Subtitles", val subtitlesOff: String = "Off", val audio: String = "Audio", val playbackSpeed: String = "Playback speed", val speedNormal: String = "Normal", val speedValue: String = "{speed}×", val quality: String = "Video quality", val qualityAuto: String = "Auto", val qualityHeight: String = "{height}p", val qualityBitrate: String = "{kbps} kbps", val qualityAdaptive: String = "adaptive", val audioDefault: String = "Default", val trackUnknown: String = "Unknown", val audioFallback: String = "Audio {n}", val subtitlesFallback: String = "Subtitles {n}", val audioChannels: String = "{name} · {channels}ch", val live: String = "LIVE", val goLive: String = "Go to live", val upNext: String = "Next in {seconds}", val playNext: String = "Play next: {title}", val nextVideo: String = "next video", val ad: String = "AD", val adPod: String = "{index}/{count}", val learnMore: String = "Learn more", val skipAd: String = "Skip ad", val skipIn: String = "Skip in {seconds}", val pauseAd: String = "Pause ad", val resumeAd: String = "Resume ad", val adBlockedTitle: String = "Ads are blocked", val adBlockedText: String = "This video is made available with ads, but your ad blocker prevented them from loading. Your video plays on without ads — please consider allowing ads for this site to support it.", val adBlockedTextHard: String = "This video is only available with ads. Please disable your ad blocker for this site, then reload.", val adBlockedDismiss: String = "Got it", val adBlockedReload: String = "I disabled it — reload", val dismiss: String = "Dismiss", val errorGeneric: String = "Playback error {code}", val retry: String = "Retry", val downloading: String = "Downloading", val downloadingItemsOne: String = "Downloading 1 item", val downloadingItems: String = "Downloading {count} items", val cast: String = "Cast", val castConnecting: String = "Connecting to cast device", val casting: String = "Casting", val castConnectingStatus: String = "Connecting…", val castingTo: String = "Casting to {device}", val airPlay: String = "AirPlay", val airPlayTo: String = "AirPlay — {device}", val pipPlaying: String = "Playing in picture in picture", val sponsored: String = "Sponsored")

Every text the built-in chrome shows or speaks, English by default: pass your own for any language via OGUiConfig.Builder.setStrings (the vertical feed takes the same type through its own config). There is no automatic locale detection — the chrome stays English until you hand it strings.

Link copied to clipboard

Visual configuration for OGPlayerView's built-in controls. Every button icon can be replaced with a drawable resource (PNG/vector); when unset, the SDK's built-in vector shapes are drawn. For a completely different control layout, pass customControls to OGPlayerView instead.

Link copied to clipboard

3x3 grid of anchor positions for app-supplied overlays rendered above the video and below the playback controls.

Link copied to clipboard
Link copied to clipboard
interface PipHandler

Implemented by the host app to put the activity into picture-in-picture. Passing a handler to OGPlayerView IS the enable switch: with one set, the player feeds it live video state (aspect ratio, on-screen bounds, auto-enter eligibility) and reacts to PiP transitions — there is no PiP button in the player chrome, entering is the handler's (i.e. the developer's) decision.

Link copied to clipboard
fun interface PipListener

Observer of picture-in-picture transitions.

Link copied to clipboard
class PipVideoState(val videoWidth: Int, val videoHeight: Int, val sourceBounds: Rect?, val isPlaying: Boolean, val autoEnterEligible: Boolean)

Snapshot of the video state a PipHandler needs to keep the system PiP parameters current. Produced by OGPlayerView; hosts implementing PipHandler directly receive it via PipHandler.onPipStateChanged.

Functions

Link copied to clipboard

True when the app is running on a television (Android TV, Google TV, Fire TV): the system UI mode is UI_MODE_TYPE_TELEVISION, or the device declares the leanback feature.

Link copied to clipboard
fun OGPlayerView(player: OGPlayer, modifier: Modifier = Modifier, uiConfig: OGUiConfig = OGUiConfig.DEFAULT, fullscreenHandler: FullscreenHandler? = null, pipHandler: PipHandler? = null, autoEnterPipOnBackground: Boolean = true, overlays: Map<OverlaySlot, @Composable () -> Unit> = emptyMap(), overlayOffsets: Map<OverlaySlot, DpOffset> = emptyMap(), startInFullscreen: Boolean = false, autoFullscreenOnRotate: Boolean = false, doubleTapToSeek: Boolean = true, onFullscreenExitRequest: () -> Unit? = null, customControls: @Composable () -> Unit? = null, errorOverlay: @Composable (error: OGPlayerError, retry: () -> Unit) -> Unit? = null)

Composable video surface with the SDK's playback controls overlaid. Tap toggles controls visibility; controls auto-hide while playing.