PresentationState

@UnstableApi
class PresentationState


State that holds information to correctly deal with UI components related to the rendering of frames to a surface.

Summary

Public constructors

PresentationState(keepContentOnReset: Boolean)

Public functions

suspend Unit
observe(player: Player?)

Subscribes to updates from Player.Events and listens to

Unit

Public properties

Boolean

set to false when the Player emits Player.EVENT_RENDERED_FIRST_FRAME and reset back to true on Player.EVENT_TRACKS_CHANGED depending on the number and type of tracks.

Player?
@VisibleForTesting(otherwise = 2)
player
Boolean

set to true when artwork should be displayed.

Float?

the aspect ratio of the video (width / height), adjusted for VideoSize.pixelWidthHeightRatio.

Size?

This property is deprecated. Use videoAspectRatio instead.

Public constructors

PresentationState

PresentationState(keepContentOnReset: Boolean = false)
Parameters
keepContentOnReset: Boolean = false

whether the currently displayed video frame or media artwork is kept visible when tracks change or player changes. Defaults to false.

Public functions

observe

suspend fun observe(player: Player?): Unit

Subscribes to updates from Player.Events and listens to

updateForCurrentTrackSelections

@VisibleForTesting(otherwise = 2)
fun updateForCurrentTrackSelections(player: Player?): Unit

Public properties

coverSurface

val coverSurface: Boolean

set to false when the Player emits Player.EVENT_RENDERED_FIRST_FRAME and reset back to true on Player.EVENT_TRACKS_CHANGED depending on the number and type of tracks.

player

@VisibleForTesting(otherwise = 2)
var player: Player?

showArtwork

val showArtwork: Boolean

set to true when artwork should be displayed. It does not guarantee that the current media item actually contains artwork data; the caller is responsible for validating the presence of artwork before rendering.

videoAspectRatio

val videoAspectRatio: Float?

the aspect ratio of the video (width / height), adjusted for VideoSize.pixelWidthHeightRatio. Becomes null when either height or width of the video is zero, or player is null.

videoSizeDp

val videoSizeDp: Size?

Wraps the video size in Compose's Size.

Use videoAspectRatio instead.