Skip to content

perf: playlist playback + media cache; serialization alignment#2

Merged
clown6613 merged 1 commit into
mainfrom
feat/playback-improvements
Jun 20, 2026
Merged

perf: playlist playback + media cache; serialization alignment#2
clown6613 merged 1 commit into
mainfrom
feat/playback-improvements

Conversation

@clown6613

Copy link
Copy Markdown
Owner

Summary

Reduces perceived load time on the reels feed without breaking the singleton-player requirement (still exactly one ExoPlayer).

Changes

  • Playlist playback: load the whole feed as one playlist (setMediaItems) and switch reels via seekToDefaultPosition(index). ExoPlayer pre-buffers neighbouring items, so swiping to the next reel starts much faster. ReelPlayerController now exposes setReels() / playAt() instead of bind().
  • Media cache: a 256 MB LRU SimpleCache + CacheDataSource so already-watched reels start instantly on re-watch.
  • Serialization alignment: bump kotlinx-serialization to 1.8.0 (matches the Kotlin 2.1 plugin, clears the InternalSerializationApi warning) and add a file-level opt-in on NetworkReel so IDE analyzers stay quiet.

Testing

  • ./gradlew lintDebug testDebugUnitTest assembleDebug green
  • Ran on an emulator — playback works; swiping between reels is noticeably quicker

Notes

The singleton remains one ExoPlayer; only the playlist/seek strategy changed. Frame-thumbnail extraction was explored separately and intentionally not included (off-screen GPU readback was unreliable); thumbnails stay required.

🤖 Generated with Claude Code

Improve perceived load time without breaking the singleton-player rule (still exactly
one ExoPlayer):

- Load the whole feed as a single playlist (setMediaItems) and switch reels with
  seekToDefaultPosition(index), so ExoPlayer pre-buffers neighbouring items and swipes
  start faster. ReelPlayerController exposes setReels()/playAt() instead of bind().
- Add a 256 MB LRU media cache (SimpleCache + CacheDataSource) so re-watched reels start
  instantly.
- Bump kotlinx-serialization to 1.8.0 to match the Kotlin 2.1 plugin (clears the
  InternalSerializationApi warning); add a file-level opt-in on NetworkReel for IDEs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@clown6613 clown6613 merged commit f75cb67 into main Jun 20, 2026
2 checks passed
@clown6613 clown6613 deleted the feat/playback-improvements branch June 20, 2026 16:11
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