KitePlayerView
A reusable Android player view for layouts, programmatic UI, and Compose AndroidView interop.
This artifact owns only Android view lifecycle and layout. A view with no rendererFactory of its own uses PlayerViewDefaults.rendererFactory, which the kiteplayer module sets when it builds a player, so view.player = player is the whole setup. The renderer is attached as soon as both the player and a factory exist, even before the Surface does, so renderer-coupled hardware decoders can take part in decoder selection. Media may open before or after that: a player that decoded without a renderer moves to the renderer's own decoder when the renderer arrives. Surface creation and destruction are forwarded into that same renderer generation; temporary backgrounding does not reconstruct the player or decoder.
Subtitles use a transparent view above the Surface, so cue changes can redraw while video is paused. That view covers the whole player, bars included, and this view gives its size to the renderer through setViewport, so the engine lays the text out for it: docs/subtitle-placement.md. The renderer adapter reports subtitle overlays and video geometry through the callbacks supplied by this view.
Call release when the owner is permanently destroyed. An Activity normally does that from onDestroy; an AndroidView wrapper does it from its onRelease callback. Merely detaching this view from a window is not proof that it will not be reused, so detachment does not release it.
All members must be used from the main thread, where Android delivers the callbacks that drive them.
Properties
Builds what a screen reader says about the state from the status, the position and the duration. The default, accessibilityStateText, is English; pass a translated one.
What a screen reader calls this view. English by default; pass a translated one.
Frames that reached no surface for a reason other than being superseded.
Keeps the display from dimming and locking while the player plays video and this view is on screen, through View.setKeepScreenOn. True by default. A paused or ended player, or one that plays audio only, lets the display sleep again.
The player whose picture this view shows. Assigning replaces the previous pairing; null detaches. Playback never depends on this being set.
Frames posted to this view's surface, across every renderer this view has built.
Creates the renderer attached to player. Null uses PlayerViewDefaults.rendererFactory, and the view stays headless when that is null too.
Frames replaced by a newer one before they could be drawn. See the renderer's own docs.
Functions
Enters picture in picture with this view's own parameters.
Keeps activity's picture-in-picture parameters matching what this view is showing.
Parameters for Activity.enterPictureInPictureMode: the video's own aspect, turned with its rotation and clamped to what the OS accepts, this view's video area as the source rectangle so the transition starts from the picture, and on API 31 and later auto-enter armed while the player is playing when autoEnterWhilePlaying is set. The activity owns the transition and the manifest; rebuild these whenever the picture or the play state changes, because the OS reads auto-enter from the parameters once rather than watching anything.
Re-reads what a screen reader should say about the player and tells the platform.