package io.github.kmpmpv import io.github.kmpmpv.internal.createPlatformMpvEngine import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow public interface MpvPlayer { public val events: SharedFlow public val state: StateFlow public suspend fun load( path: String, mode: MpvLoadMode = MpvLoadMode.Replace, ) public suspend fun play() public suspend fun pause() public suspend fun togglePause() public suspend fun stop() public suspend fun seek( seconds: Double, mode: MpvSeekMode = MpvSeekMode.Absolute, ) public suspend fun command(vararg arguments: String) public suspend fun getProperty(name: String, format: MpvFormat): MpvValue public suspend fun setProperty(name: String, value: MpvValue) public suspend fun getStringProperty(name: String): String? public suspend fun getBooleanProperty(name: String): Boolean? public suspend fun getLongProperty(name: String): Long? public suspend fun getDoubleProperty(name: String): Double? public suspend fun observeProperty(name: String, format: MpvFormat): Long public suspend fun unobserveProperty(observationId: Long) public suspend fun requestLogMessages(level: MpvLogLevel) public suspend fun attachRenderTarget(target: MpvRenderTarget) public suspend fun detachRenderTarget() /** Updates Android's `android-surface-size`; harmless on other platforms. */ public suspend fun updateRenderTargetSize(width: Int, height: Int) /** * Renders the current video image through mpv's software render API. * * This is primarily intended for iOS, where libmpv does not provide a native window output. */ public suspend fun renderSoftwareFrame(width: Int, height: Int): MpvSoftwareFrame /** Stops event delivery and destroys the underlying mpv client. Idempotent. */ public suspend fun release() public companion object { @Throws(MpvException::class) public fun create(configuration: MpvConfiguration = MpvConfiguration()): MpvPlayer = DefaultMpvPlayer(createPlatformMpvEngine(configuration), configuration) } } public enum class MpvLoadMode(internal val commandValue: String) { Replace("replace"), Append("append"), AppendAndPlay("append-play"), InsertNext("insert-next"), InsertNextAndPlay("insert-next-play"), } public enum class MpvSeekMode(internal val commandValue: String) { Relative("relative"), Absolute("absolute"), AbsolutePercent("absolute-percent"), RelativePercent("relative-percent"), }