THEOplayerAdapter

THEOplayer implementation of the portable PlayerAdapter (PLAYG-398).

Wraps a Player the integrator owns — a plain THEOplayerView.player, or the native player resolved from a react-native-theoplayer view by the RN bridge — so the SDK drives THEOplayer-based content exactly like it drives Media3 through ExoPlayerAdapter. The adapter never owns the player: destroy detaches listeners and nothing else.

Thread safety

THEOplayer is main-thread-affine: its API must be called on the Android main thread. The SDK reads currentTime from whatever thread drives the scheduler ticker (Dispatchers.Default by default), so — like ExoPlayerAdapter — this adapter is safe from ANY thread:

  • Reads are served from a @Volatile snapshot refreshed ON the main thread, after every player callback and on a periodic poll (the playhead advances between callbacks).

  • Commands run inline when already on the main thread and are posted to it otherwise.

Timed metadata

In-stream markers (HLS ID3 / EXT-X-DATERANGE / DASH emsg) arrive as cues on THEOplayer text tracks of kind metadata; the adapter subscribes to every such track as it appears and forwards each new cue as a TIMEDMETADATA event with a portable TimedMetadataCue payload (the Anvato signal path for ptsSource = ANVATO_CUE).

Constructors

Link copied to clipboard
constructor(player: Player)

Properties

Link copied to clipboard
open override val currentTime: Double

PlayerAdapter.currentTime from the main-thread snapshot, in seconds.

Link copied to clipboard
open override val duration: Double

PlayerAdapter.duration from the snapshot, in seconds.

Link copied to clipboard
open override val isLive: Boolean?

PlayerAdapter.isLive from the snapshot: whether THEOplayer reports an infinite duration.

Link copied to clipboard
open override val liveEdge: Double?

The real live edge. Prefers the engine's own window end, which exceeds THEOplayer's seekable.end by the HLS hold-back (measured 18.0s on a 6s-segment stream, OPTI-4733); falls back to the seekable end plus any latency target this adapter applied itself.

Link copied to clipboard
open override var muted: Boolean

PlayerAdapter.muted: reads the snapshot, writes on the main thread.

Link copied to clipboard
open override val paused: Boolean

PlayerAdapter.paused from the snapshot.

Link copied to clipboard
open override var playbackRate: Double

Playback rate, read from the ENGINE rather than echoed from the last write.

Link copied to clipboard
open override val playbackReady: Boolean

True once the source has a known duration and, for live, a seekable range.

Link copied to clipboard
open override val programDateTime: Long?

PlayerAdapter.programDateTime: the stream's program date time at the current position, in milliseconds since the Unix epoch; null without one.

Link copied to clipboard
open override val seekableEnd: Double?

End of THEOplayer's last seekable range (its live point) in seconds; null before one exists.

Link copied to clipboard
open override val seekableStart: Double?

Start of THEOplayer's last seekable range in seconds; null before one exists.

Link copied to clipboard
open override var volume: Double

PlayerAdapter.volume (0.0 to 1.0): reads the snapshot, writes on the main thread.

Functions

Link copied to clipboard
open override fun contentVideoSize(): ContentVideoSize?

ContentVideoSizeProvider: lets the renderer confine break layouts to the video.

Link copied to clipboard
open override fun destroy()

PlayerAdapter.destroy: removes the THEOplayer listeners; the player itself is left to the app.

Link copied to clipboard
open override fun load(url: String)

PlayerAdapter.load: sets url as the THEOplayer source on the main thread.

Link copied to clipboard
open override fun off(event: PlayerAdapterEvent, handler: PlayerAdapterEventHandler)

PlayerAdapter.off: removes a handler added with on.

Link copied to clipboard
open override fun on(event: PlayerAdapterEvent, handler: PlayerAdapterEventHandler)
Link copied to clipboard
open override fun pause()

PlayerAdapter.pause on the main thread.

Link copied to clipboard
open override fun play()

PlayerAdapter.play on the main thread.

Link copied to clipboard
open override fun requestLiveStartOffset(targetDurations: Double?, fallbackTargetDuration: Double?): Boolean

Makes THEOplayer itself begin a live source targetDurations × fallbackTargetDuration behind live, by re-setting the host's source with that liveOffset before its first frame loads. THEOplayer exposes no playlist target duration, so the fallback is required. Returns false once a frame loaded; a source that cannot be copied losslessly is left alone and the SDK seeks.

Link copied to clipboard
open override fun seek(time: Double)

PlayerAdapter.seek to time seconds on the main thread.

Link copied to clipboard
open override fun seekExact(time: Double)

PlayerAdapter.seekExact — the SDK-owned resume seek, routed around THEOplayer's seekable clamp when the engine is reachable.

Link copied to clipboard
open override fun setVideoQuality(quality: VideoQuality?): Boolean

Pin the cheapest rendition by assigning a single VideoQuality to targetQuality, which both selects it and disables ABR for the track.