diff --git a/experimental/components/VideoPlayer/library/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt b/experimental/components/VideoPlayer/library/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt index c5f999c161..9fa10b590d 100644 --- a/experimental/components/VideoPlayer/library/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt +++ b/experimental/components/VideoPlayer/library/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt @@ -90,9 +90,9 @@ private fun initializeMediaPlayerComponent(): Component { private fun MediaPlayer.setupVideoFinishHandler(onFinish: (() -> Unit)?) { DisposableEffect(onFinish) { val listener = object : MediaPlayerEventAdapter() { - override fun stopped(mediaPlayer: MediaPlayer) { + override fun finished(mediaPlayer: MediaPlayer) { onFinish?.invoke() - mediaPlayer.controls().play() + mediaPlayer.submit { mediaPlayer.controls().play() } } } events().addMediaPlayerEventListener(listener)