We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b499fa7 + b64cc1c commit 13cb1d9Copy full SHA for 13cb1d9
mediaplayer/src/iosMain/kotlin/io/github/kdroidfilter/composemediaplayer/VideoPlayerState.ios.kt
@@ -252,8 +252,18 @@ open class DefaultVideoPlayerState: VideoPlayerState {
252
queue = null
253
) { _ ->
254
if (_loop) {
255
- player.seekToTime(CMTimeMakeWithSeconds(0.0, 1))
256
- player.playImmediatelyAtRate(_playbackSpeed)
+ val zeroTime = CMTimeMake(0, 1)
+ player.seekToTime(
257
+ time = CMTimeMakeWithSeconds(0.0, NSEC_PER_SEC.toInt()),
258
+ toleranceBefore = zeroTime,
259
+ toleranceAfter = zeroTime
260
+ ) { finished ->
261
+ if (finished) {
262
+ dispatch_async(dispatch_get_main_queue()) {
263
+ player.playImmediatelyAtRate(_playbackSpeed)
264
+ }
265
266
267
} else {
268
player.pause()
269
_isPlaying = false
0 commit comments