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

Public functions

suspend Nothing

Subscribes to updates from Player.Events and listens to

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.

Boolean

whether the currently displayed video frame or media artwork is kept visible when tracks change.

Size?

wraps Player.getVideoSize in Compose's Size, becomes null when either height or width of the video is zero.

Public constructors

PresentationState

PresentationState(player: Player)

Public functions

observe

suspend fun observe(): Nothing

Subscribes to updates from Player.Events and listens to

Public properties

coverSurface

val coverSurfaceBoolean

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.

keepContentOnReset

var keepContentOnResetBoolean

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

videoSizeDp

val videoSizeDpSize?

wraps Player.getVideoSize in Compose's Size, becomes null when either height or width of the video is zero. Takes into account VideoSize.pixelWidthHeightRatio to return a Size in Dp, i.e. device-independent pixel. To use this measurement in Compose's Drawing and Layout stages, convert it into pixels using Density.toPx. Note that for cases where pixelWidthHeightRatio is not equal to 1, the rescaling will be down, i.e. reducing the width or the height to achieve the same aspect ratio in square pixels.