Skip to content

fix: loop no smooth on Ios player#164

Merged
kdroidFilter merged 1 commit intokdroidFilter:masterfrom
YoussefHachicha:issue-126-loop-not-smooth-on-ios
Feb 2, 2026
Merged

fix: loop no smooth on Ios player#164
kdroidFilter merged 1 commit intokdroidFilter:masterfrom
YoussefHachicha:issue-126-loop-not-smooth-on-ios

Conversation

@YoussefHachicha
Copy link
Copy Markdown
Contributor

@YoussefHachicha YoussefHachicha commented Feb 2, 2026

Summary

  • Fix the noticeable delay when video loops on iOS by using precise seeking with completion handler
  • The seek operation now waits for completion before resuming playback
  • Playback resumes on the main thread for thread safety

Changes

  • Use seekToTime with zero tolerance (toleranceBefore and toleranceAfter) for precise seeking
  • Wait for seek completion via callback before calling playImmediatelyAtRate
  • Dispatch playback resume to main queue

Test plan

  • Play a short video with loop enabled on iOS
  • Observe the loop point - should be seamless without visible delay
  • Test with different video lengths
  • Test remote and local videos

Fixes #126

@YoussefHachicha
Copy link
Copy Markdown
Contributor Author

@marioortizmanero check this

@kdroidFilter
Copy link
Copy Markdown
Owner

Thank you very much, I think this should fix the issue. Could you provide a screen recording showing before and after the change?

@YoussefHachicha
Copy link
Copy Markdown
Contributor Author

fix-126-issue-demo.mov

@kdroidFilter
Copy link
Copy Markdown
Owner

sorry, can you check with a sample like this https://pixabay.com/videos/neon-terrain-80-retro-abstract-21368/ ? (download it)

@Teodor82
Copy link
Copy Markdown

Teodor82 commented Feb 2, 2026

PR #164 looks good, and the zero-tolerance seek with playback resumed after completion makes sense for avoiding loop stutter on iOS.
If helpful, I can assist with verification (pixabay sample, different playback speeds, background/foreground) or add a short test checklist after merge.

@YoussefHachicha
Copy link
Copy Markdown
Contributor Author

Screen.Recording.2026-02-02.at.10.06.26.PM.mov

@kdroidFilter kdroidFilter merged commit 13cb1d9 into kdroidFilter:master Feb 2, 2026
@kdroidFilter
Copy link
Copy Markdown
Owner

Great ! Thanks a lot !

@marioortizmanero
Copy link
Copy Markdown
Contributor

marioortizmanero commented Feb 3, 2026

Thank you guys for the help! I will test it early next week and send a confirmation. In the meanwhile feel free to share your paypal details for the bounty

@Teodor82
Copy link
Copy Markdown

Teodor82 commented Feb 3, 2026

Thanks Mario! 🙌

@marioortizmanero
Just to clarify, PR #164 was implemented and merged by @YoussefHachicha , so the bounty should go to them.

If you need any additional testing, verification on iOS, or follow-up fixes after your testing next week, I’m happy to help.

@YoussefHachicha
Copy link
Copy Markdown
Contributor Author

@marioortizmanero can u send the money to my friend dhia by the end of the month additional to his pay, he will give it to me in person, our country dosent support paypal

@marioortizmanero
Copy link
Copy Markdown
Contributor

@YoussefHachicha just send me the email address and I'll be happy to send the money there

@YoussefHachicha
Copy link
Copy Markdown
Contributor Author

YoussefHachicha commented Feb 4, 2026

@marioortizmanero
Copy link
Copy Markdown
Contributor

marioortizmanero commented Feb 22, 2026

Hey sorry for being so late in the end. I'm running the side-by-side comparison but I think this isn't fixed for me yet? I've tried on an iPhone SE. Here's the before and after, and the original video:

Before this patch:

ScreenRecording_02-22-2026.17-23-46_1.MP4

After this patch:

ScreenRecording_02-22-2026.17-32-55_1.MP4

Here's the original video:

JUMPING_JACKS.mp4

And here's the original video playing multiple times in a row to show the expected smoothness (just copy-pasted the track 4 times on CapCut):

0222.mp4

My code is just:

@Composable
fun VideoLoopReproduction() {
    val videoPlayerState = rememberVideoPlayerState()

    LaunchedEffect(Unit) {
        videoPlayerState.volume = 0f
        videoPlayerState.loop = true
        videoPlayerState.openUri("https://example.com/video.mp4")
    }

    VideoPlayer(videoPlayerState)
}

@marioortizmanero
Copy link
Copy Markdown
Contributor

Also @kdroidFilter I think 0.8.8 is missing on Maven, I just did these tests locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[$50 BOUNTY] Loop isn't smooth

4 participants