VideoPlayerState

@Stable
interface VideoPlayerState

Represents the state and controls for a video player. This class provides properties and methods to manage video playback, including play, pause, stop, seeking, and more. It maintains information about the playback state, such as whether the video is currently playing, volume levels, and playback position.

Functions of this class are tied to managing and interacting with the underlying video player implementation.

Inheritors

DefaultVideoPlayerState
LinuxVideoPlayerState
MacVideoPlayerState
WindowsVideoPlayerState

Properties

Link copied to clipboard
abstract val aspectRatio: Float
Link copied to clipboard
abstract val availableSubtitleTracks: MutableList<SubtitleTrack>
Link copied to clipboard
Link copied to clipboard
abstract val currentTime: Double
Link copied to clipboard
abstract val durationText: String

Returns the total duration of the video as a formatted string.

Link copied to clipboard
abstract val error: VideoPlayerError?
Link copied to clipboard
abstract val hasMedia: Boolean
Link copied to clipboard
abstract var isFullscreen: Boolean
Link copied to clipboard
abstract val isLoading: Boolean
Link copied to clipboard
abstract val isPlaying: Boolean

Indicates whether the video is currently playing.

Link copied to clipboard
abstract val leftLevel: Float

Provides the audio level for the left channel as a percentage.

Link copied to clipboard
abstract var loop: Boolean

Specifies if the video should loop when it reaches the end.

Link copied to clipboard
abstract val metadata: VideoMetadata
Link copied to clipboard
abstract var playbackSpeed: Float
Link copied to clipboard
abstract val positionText: String

Returns the current playback position as a formatted string.

Link copied to clipboard
abstract val rightLevel: Float

Provides the audio level for the right channel as a percentage.

Link copied to clipboard
abstract var sliderPos: Float

Represents the current playback position as a normalized value between 0.0 and 1.0.

Link copied to clipboard
abstract var subtitleBackgroundColor: Color
Link copied to clipboard
abstract var subtitlesEnabled: Boolean
Link copied to clipboard
abstract var subtitleTextStyle: TextStyle
Link copied to clipboard
abstract var userDragging: Boolean

Denotes whether the user is manually adjusting the playback position.

Link copied to clipboard
abstract var volume: Float

Controls the playback volume. Valid values are within the range of 0.0 (muted) to 1.0 (maximum volume).

Functions

Link copied to clipboard
abstract fun clearError()
Link copied to clipboard
abstract fun disableSubtitles()
Link copied to clipboard
abstract fun dispose()

Releases resources used by the video player and disposes of the state.

Link copied to clipboard
abstract fun openFile(file: PlatformFile, initializeplayerState: InitialPlayerState = InitialPlayerState.PLAY)
Link copied to clipboard
abstract fun openUri(uri: String, initializeplayerState: InitialPlayerState = InitialPlayerState.PLAY)

Opens a video file or URL for playback.

Link copied to clipboard
abstract fun pause()

Pauses video playback.

Link copied to clipboard
abstract fun play()

Starts or resumes video playback.

Link copied to clipboard
abstract fun seekTo(value: Float)

Seeks to a specific playback position based on the provided normalized value.

Link copied to clipboard
abstract fun selectSubtitleTrack(track: SubtitleTrack?)
Link copied to clipboard
abstract fun stop()

Stops playback and resets the player state.

Link copied to clipboard
abstract fun toggleFullscreen()