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 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 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 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 seek(time: Double)

PlayerAdapter.seek to time seconds on the main thread.

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.