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
@Volatilesnapshot 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).
Properties
PlayerAdapter.currentTime from the main-thread snapshot, in seconds.
PlayerAdapter.duration from the snapshot, in seconds.
PlayerAdapter.isLive from the snapshot: whether THEOplayer reports an infinite duration.
PlayerAdapter.muted: reads the snapshot, writes on the main thread.
PlayerAdapter.paused from the snapshot.
Playback rate, read from the ENGINE rather than echoed from the last write.
True once the source has a known duration and, for live, a seekable range.
PlayerAdapter.programDateTime: the stream's program date time at the current position, in milliseconds since the Unix epoch; null without one.
End of THEOplayer's last seekable range (its live point) in seconds; null before one exists.
Start of THEOplayer's last seekable range in seconds; null before one exists.
PlayerAdapter.sourceUrl from the snapshot: the first source of the current THEOplayer source description.
PlayerAdapter.volume (0.0 to 1.0): reads the snapshot, writes on the main thread.
Functions
ContentVideoSizeProvider: lets the renderer confine break layouts to the video.
PlayerAdapter.destroy: removes the THEOplayer listeners; the player itself is left to the app.
PlayerAdapter.load: sets url as the THEOplayer source on the main thread.
PlayerAdapter.off: removes a handler added with on.
PlayerAdapter.on: subscribes handler to event.
PlayerAdapter.pause on the main thread.
PlayerAdapter.play on the main thread.
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.
PlayerAdapter.seek to time seconds on the main thread.
PlayerAdapter.seekExact uses THEOplayer for VOD and bypasses its live seekable clamp only when the engine is reachable.
Pin the cheapest rendition by assigning a single VideoQuality to targetQuality, which both selects it and disables ABR for the track.