Skip to content

feat: add onPlaybackEnded callback to VideoPlayerState#191

Merged
kdroidFilter merged 3 commits into
masterfrom
feat/on-playback-ended-callback
Apr 11, 2026
Merged

feat: add onPlaybackEnded callback to VideoPlayerState#191
kdroidFilter merged 3 commits into
masterfrom
feat/on-playback-ended-callback

Conversation

@kdroidFilter
Copy link
Copy Markdown
Owner

@kdroidFilter kdroidFilter commented Apr 11, 2026

Summary

  • Add onPlaybackEnded: (() -> Unit)? callback property to VideoPlayerState interface, invoked when playback reaches the end and loop is false
  • Implement callback invocation on all 6 platforms: Android, iOS, Windows, macOS, Linux, Web/WASM
  • Fix incorrect KDoc for sliderPos (was "0.0 to 1.0", corrected to "0.0 to 1000.0") and seekTo

Test plan

  • Play a video to the end with loop = false and verify onPlaybackEnded is called
  • Play a video with loop = true and verify onPlaybackEnded is NOT called
  • Verify callback works on Android, iOS, Desktop (Win/Mac/Linux), and Web
  • Verify setting onPlaybackEnded = null does not cause crashes

Closes #152

Add a nullable lambda callback that is invoked when playback reaches
the end of media and loop is disabled. Implemented across all platforms:
Android (ExoPlayer STATE_ENDED), iOS (AVPlayerItemDidPlayToEndTimeNotification),
Windows (IsEOF), macOS/Linux (nConsumeDidPlayToEnd), and Web (HTML5 ended event).

Also fix sliderPos and seekTo KDoc to document the correct 0-1000 range.

Closes #152
…layerState classes

Simplified code by removing redundant `.toInt()` calls for `rowBytes` and `path`, ensuring consistency and clarity across macOS and Linux platform implementations.
@kdroidFilter kdroidFilter merged commit 47044e6 into master Apr 11, 2026
9 checks passed
@kdroidFilter kdroidFilter deleted the feat/on-playback-ended-callback branch April 11, 2026 21:17
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.

Documentation issue with sliderPos

1 participant