Package-level declarations

Types

Link copied to clipboard
data class AudioMode(val interruptionMode: InterruptionMode = InterruptionMode.DoNotMix, val playsInSilentMode: Boolean = true)

Configures how the media player interacts with the system audio session.

Link copied to clipboard
data class CacheConfig(val enabled: Boolean = false, val maxCacheSizeBytes: Long = 100L * 1024L * 1024L)

Configuration for video caching. When enabled, downloaded video data is stored on disk so that subsequent plays of the same URI load from the local cache instead of re-downloading.

DefaultVideoPlayerState
Link copied to clipboard
open class DefaultVideoPlayerState(audioMode: AudioMode = AudioMode(), cacheConfig: CacheConfig = CacheConfig()) : VideoPlayerState
open class DefaultVideoPlayerState(audioMode: AudioMode = AudioMode(), cacheConfig: CacheConfig = CacheConfig()) : 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.

Implementation of VideoPlayerState for WebAssembly/JavaScript platform. Manages the state of a video player including playback controls, media information, and error handling.

Link copied to clipboard

Manages fullscreen functionality for the video player

Link copied to clipboard

Represents the initial state of the player after opening a media file or URI.

Link copied to clipboard

Controls how the media player interacts with other apps' audio.

Link copied to clipboard
data class PreviewableVideoPlayerState(val hasMedia: Boolean = true, val isPlaying: Boolean = true, val isLoading: Boolean = false, var volume: Float = 1.0f, var sliderPos: Float = 500.0f, var userDragging: Boolean = false, var loop: Boolean = true, var playbackSpeed: Float = 1.0f, val positionText: String = "00:05", val durationText: String = "00:10", val currentTime: Double = 5000.0, val duration: Double = 10.0, var isFullscreen: Boolean = false, val aspectRatio: Float = 1.7f, val error: VideoPlayerError? = null, val metadata: VideoMetadata = VideoMetadata(), var subtitlesEnabled: Boolean = false, var currentSubtitleTrack: SubtitleTrack? = null, val availableSubtitleTracks: MutableList<SubtitleTrack> = emptyList<SubtitleTrack>().toMutableList(), var subtitleTextStyle: TextStyle = TextStyle.Default, var subtitleBackgroundColor: Color = Color.Transparent, val isPipSupported: Boolean = false, var isPipActive: Boolean = false, var isPipEnabled: Boolean = false, var onPlaybackEnded: () -> Unit? = null, var onRestart: () -> Unit? = null) : VideoPlayerState

Helper to mock the VideoPlayerState.

Link copied to clipboard
data class SubtitleTrack(val label: String, val language: String, val src: String)
Link copied to clipboard
Link copied to clipboard
class VideoMetadata(title: String? = null, duration: Long? = null, width: Int? = null, height: Int? = null, bitrate: Long? = null, frameRate: Float? = null, mimeType: String? = null, audioChannels: Int? = null, audioSampleRate: Int? = null)

Represents metadata information of a video file.

Link copied to clipboard
sealed class VideoPlayerError

Represents different types of errors that can occur during video playback in a video player.

Link copied to clipboard

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

Link copied to clipboard
Link copied to clipboard
actual fun createVideoPlayerState(audioMode: AudioMode, cacheConfig: CacheConfig): VideoPlayerState

Create platform-specific video player state. Supported platforms include Windows, macOS, and Linux.

expect fun createVideoPlayerState(audioMode: AudioMode = AudioMode(), cacheConfig: CacheConfig = CacheConfig()): VideoPlayerState

Create platform-specific video player state. Supported platforms include Windows, macOS, and Linux.

actual fun createVideoPlayerState(audioMode: AudioMode, cacheConfig: CacheConfig): VideoPlayerState

Create platform-specific video player state. Supported platforms include Windows, macOS, and Linux.

actual fun createVideoPlayerState(audioMode: AudioMode, cacheConfig: CacheConfig): VideoPlayerState

Create platform-specific video player state. Supported platforms include Windows, macOS, and Linux.

actual fun createVideoPlayerState(audioMode: AudioMode, cacheConfig: CacheConfig): VideoPlayerState

Create platform-specific video player state. Supported platforms include Windows, macOS, and Linux.

Link copied to clipboard
fun openFullscreenView(playerState: VideoPlayerState, renderSurface: (VideoPlayerState, ERROR CLASS: Symbol not found for Modifier, Boolean) -> Unit)

Opens a fullscreen view for the video player on iOS. This function is called when the user toggles fullscreen mode.

Link copied to clipboard
fun rememberVideoPlayerState(audioMode: AudioMode = AudioMode(), cacheConfig: CacheConfig = CacheConfig()): VideoPlayerState

Creates and remembers a VideoPlayerState, automatically releasing all player resources when the composable leaves the composition.

Link copied to clipboard
actual fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier, contentScale: ContentScale, overlay: () -> Unit)

Renders a video player surface that displays and controls video playback.

fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier = Modifier, contentScale: ContentScale = ContentScale.Fit, surfaceType: SurfaceType = SurfaceType.TextureView, overlay: @Composable () -> Unit = {})
expect fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier = Modifier, contentScale: ContentScale = ContentScale.Fit, overlay: @Composable () -> Unit = {})

Renders a video player surface that displays and controls video playback.

actual fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: ERROR CLASS: Symbol not found for Modifier, contentScale: ERROR CLASS: Symbol not found for ContentScale, overlay: () -> Unit)
actual fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier, contentScale: ContentScale, overlay: () -> Unit)

Renders a video player surface that displays and controls video playback.

actual fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier, contentScale: ContentScale, overlay: () -> Unit)

Composable function for rendering a video player surface.

actual fun VideoPlayerSurface(playerState: VideoPlayerState, modifier: Modifier, contentScale: ContentScale, overlay: () -> Unit)

Renders a video player surface that displays and controls video playback.

Link copied to clipboard
fun VideoPlayerSurfaceImpl(playerState: VideoPlayerState, modifier: ERROR CLASS: Symbol not found for Modifier, contentScale: ERROR CLASS: Symbol not found for ContentScale, overlay: () -> Unit, isInFullscreenView: Boolean = false, pauseOnDispose: Boolean = true)
Link copied to clipboard
fun Modifier.videoRatioClip(videoRatio: Float?, contentScale: ContentScale = ContentScale.Fit): Modifier