VideoPlayerState

@UnstableApi
@Stable
actual open class VideoPlayerState
@Stable
expect open class 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.

actual open class VideoPlayerState
@Stable
actual open class VideoPlayerState

Represents the state and behavior of a video player. This class provides properties and methods to control video playback, manage the playback state, and interact with platform-specific implementations.

The actual implementation delegates its behavior to platform-specific video player states based on the detected operating system. Supported platforms include Windows, macOS, and Linux.

Properties:

  • isPlaying: Indicates whether the video is currently playing.

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

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

  • userDragging: Denotes whether the user is manually adjusting the playback position.

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

  • leftLevel: Provides the audio level for the left channel as a percentage.

  • rightLevel: Provides the audio level for the right channel as a percentage.

  • positionText: Returns the current playback position as a formatted string.

  • durationText: Returns the total duration of the video as a formatted string.

Methods:

  • openUri(uri: String): Opens a video file or URL for playback.

  • play(): Starts or resumes video playback.

  • pause(): Pauses video playback.

  • stop(): Stops playback and resets the player state.

  • seekTo(value: Float): Seeks to a specific playback position based on the provided normalized value.

  • dispose(): Releases resources used by the video player and disposes of the state.

@Stable
actual open class VideoPlayerState

Constructors

Link copied to clipboard
constructor()
expect constructor()

Initializes an instance of the video player state.

constructor()
constructor()
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
actual val durationText: String
expect val durationText: String
actual val durationText: String
actual open val durationText: String
actual val durationText: String
Link copied to clipboard
actual val error: VideoPlayerError?
expect val error: VideoPlayerError?
actual val error: VideoPlayerError? = null
actual open val error: VideoPlayerError?
actual val error: VideoPlayerError?
Link copied to clipboard
actual val hasMedia: Boolean
expect val hasMedia: Boolean
actual val hasMedia: Boolean = false
actual open val hasMedia: Boolean
actual val hasMedia: Boolean
Link copied to clipboard
actual val isLoading: Boolean
expect val isLoading: Boolean
actual val isLoading: Boolean = false
actual open val isLoading: Boolean
actual val isLoading: Boolean
Link copied to clipboard
actual val isPlaying: Boolean
expect val isPlaying: Boolean
actual val isPlaying: Boolean = false
actual open val isPlaying: Boolean
actual val isPlaying: Boolean
Link copied to clipboard
actual val leftLevel: Float
expect val leftLevel: Float
actual val leftLevel: Float = 0.0f
actual open val leftLevel: Float
actual val leftLevel: Float
Link copied to clipboard
actual var loop: Boolean
expect var loop: Boolean
actual var loop: Boolean
actual open var loop: Boolean
actual var loop: Boolean
Link copied to clipboard
actual val metadata: VideoMetadata
actual open val metadata: VideoMetadata
Link copied to clipboard
actual val positionText: String
expect val positionText: String
actual val positionText: String
actual open val positionText: String
actual val positionText: String
Link copied to clipboard
actual val rightLevel: Float
expect val rightLevel: Float
actual val rightLevel: Float = 0.0f
actual open val rightLevel: Float
actual val rightLevel: Float
Link copied to clipboard
actual var sliderPos: Float
expect var sliderPos: Float
actual var sliderPos: Float
actual open var sliderPos: Float
actual var sliderPos: Float
Link copied to clipboard
val sourceUri: String?
Link copied to clipboard
actual var userDragging: Boolean
expect var userDragging: Boolean
actual var userDragging: Boolean
actual open var userDragging: Boolean
actual var userDragging: Boolean
Link copied to clipboard
actual var volume: Float
expect var volume: Float
actual var volume: Float
actual open var volume: Float
actual var volume: Float

Functions

Link copied to clipboard
actual fun clearError()
expect fun clearError()
actual fun clearError()
actual open fun clearError()
actual fun clearError()
Link copied to clipboard
actual fun dispose()
expect fun dispose()
actual fun dispose()
actual open fun dispose()
actual fun dispose()
Link copied to clipboard
fun onTimeUpdate(currentTime: Float, duration: Float)
Link copied to clipboard
actual fun openFile(file: PlatformFile)
expect fun openFile(file: PlatformFile)
actual fun openFile(file: <Error class: unknown class>)
actual open fun openFile(file: PlatformFile)
actual fun openFile(file: PlatformFile)
Link copied to clipboard
actual fun openUri(uri: String)
expect fun openUri(uri: String)
actual fun openUri(uri: String)
actual open fun openUri(uri: String)
actual fun openUri(uri: String)
Link copied to clipboard
actual fun pause()
expect fun pause()
actual fun pause()
actual open fun pause()
actual fun pause()
Link copied to clipboard
actual fun play()
expect fun play()
actual fun play()
actual open fun play()
actual fun play()
Link copied to clipboard
actual fun seekTo(value: Float)
expect fun seekTo(value: Float)
actual fun seekTo(value: Float)
actual open fun seekTo(value: Float)
actual fun seekTo(value: Float)
Link copied to clipboard
actual fun stop()
expect fun stop()
actual fun stop()
actual open fun stop()
actual fun stop()
Link copied to clipboard
fun updateAudioLevels(left: Float, right: Float)
Link copied to clipboard
fun updatePosition(currentTime: Float, duration: Float)