Skip to content

fix(mac): apply rotation metadata and reach 100% on progress bar#207

Merged
kdroidFilter merged 1 commit intomasterfrom
fix/mac-portrait-rotation-and-progress
Apr 17, 2026
Merged

fix(mac): apply rotation metadata and reach 100% on progress bar#207
kdroidFilter merged 1 commit intomasterfrom
fix/mac-portrait-rotation-and-progress

Conversation

@kdroidFilter
Copy link
Copy Markdown
Owner

@kdroidFilter kdroidFilter commented Apr 17, 2026

Summary

  • Portrait videos no longer render sideways on JVM/macOS (Portrait videos render rotated incorrectly on desktop (rotation metadata not applied) #202). Set an AVVideoComposition (built from the asset's preferred transform) on the AVPlayerItem so AVPlayerItemVideoOutput delivers pixel buffers already rotated to display orientation. Skipped for HLS streams whose tracks aren't synchronously available.
  • Progress bar now reaches the end of the video. The checkLoopingAsync had a 0.5 s position-based fallback that triggered pauseInBackground() half a second before the real end, freezing sliderPos at (duration - 0.5) / duration — visibly short for short videos. Removed the fallback; we now trust AVPlayerItemDidPlayToEndTime, which fires reliably on macOS for both file and HLS playback.
  • gitignore the prebuilt darwin-aarch64/ and darwin-x86-64/ dylib resource directories so they don't accidentally get committed.

Test plan

  • Open a portrait video recorded on a phone (e.g. the sample from Portrait videos render rotated incorrectly on desktop (rotation metadata not applied) #202) — it should render upright instead of sideways.
  • Verify aspect ratio remains correct for landscape videos.
  • Play a short video to completion — the progress slider should visibly reach 100% before pausing.
  • Loop mode: enable loop on a short video and confirm seamless restart.
  • HLS playback still works (no composition is applied; behavior unchanged).
  • Rebuild dylibs via mediaplayer/src/jvmMain/native/macos/build.sh for both arm64 and x86_64 and confirm clean compilation.

- Set AVVideoComposition built from the asset's preferred transform
  on the AVPlayerItem so AVPlayerItemVideoOutput delivers pixel
  buffers already rotated to display orientation. Fixes #202
  (portrait phone videos rendering sideways on JVM/macOS).
- Drop the 0.5s position-based fallback in checkLoopingAsync that
  was triggering pauseInBackground half a second before the actual
  end, freezing sliderPos at (duration - 0.5)/duration. Rely solely
  on AVPlayerItemDidPlayToEndTime, which is reliable on macOS.
- gitignore the prebuilt darwin-aarch64/x86-64 dylib resource dirs.
@kdroidFilter kdroidFilter merged commit 3807098 into master Apr 17, 2026
10 checks passed
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.

1 participant