Repository navigation
feat(player): switch libmpv to a custom build with Vulkan and HDR support - #258
Merged
Merged
Conversation
This commit migrates the player backend from `dev.jdtech.mpv` to `io.github.marlboro-advance:mpv-android`, introducing a dedicated `MpvHandle` wrapper for lifecycle management and Vulkan GPU context support. Additionally, it improves `PlayerActivity` intent handling and disables playback speed adjustments during live stream playback. Key changes: * Library Migration: Switched `libmpv` dependency to `io.github.marlboro-advance:mpv-android` and updated ProGuard rules to retain `is.xyz.mpv.**` JNI classes. * `MpvHandle` Lifecycle Wrapper: Created `MpvHandle` to manage libmpv creation, observer registration/cleanup, and lifecycle state to prevent concurrent native state corruption. * Vulkan Support & Config: Configured GPU context dynamically (`androidvk` for Vulkan, `android` with OpenGL ES otherwise) and adjusted hardware decoding to `mediacodec-copy` when using Vulkan. * Re-enabled MPV Settings: Restored advanced MPV settings in `PlayerOptionsScreen`, including GPU API, Tone Mapping, and HDR Peak Detection options. * New Intent Handling in Player: Added `PlaybackRequest` data model and implemented `onNewIntent` in `PlayerActivity` to seamlessly update active playback when receiving a new playback intent. * Live Playback Restrictions: Disabled speed modification controls, long-press speed-up, and keyboard shortcuts (`<` / `>`) when playing live channels, and automatically reset playback speed to 1.0x upon starting live playback. * Stale Item Indicator: Updated `PlayerScreenWrapper` to display a loading state while transitioning between different media item IDs.
…uts, and debounces This commit migrates raw numeric millisecond arguments passed to coroutine and flow time-based functions (`delay`, `withTimeoutOrNull`, and `debounce`) to type-safe Kotlin `Duration` extensions (`milliseconds`, `seconds`, `minutes`) across the codebase, improving code readability and consistency. Key changes: * Type-Safe Durations: Replaced raw numeric millisecond and second parameters with `Duration` equivalents across repositories, ViewModels, UI components, background workers, and playback managers. * Coroutine Scope Clarification: Added explicit labeled scoping (`this@mediaChanges.launch`) in `AppDataRepository` to clarify nested coroutine launching during media change events. * Minor Range Cleanup: Simplified sleep timer prompt threshold check in `PlayerViewModel` using Kotlin range containment (`in 1L..SLEEP_TIMER_PROMPT_THRESHOLD_MS`).
This commit migrates the player from the previous MPV wrapper to an updated `libmpv` library, while significantly enhancing error reporting and diagnostics across playback failures, including server-side transcode error inspection for admins. Key changes: * Updated `libmpv` Dependency: Upgraded to `io.github.makd:libmpv:1.1.0` using `dev.jdtech.mpv.MPVLib`, removing the legacy `MpvHandle` wrapper and outdated ProGuard rules. * Output Failure Handling in MPV: Added handling for `endFile` error codes, surfacing distinct error codes for audio (`AO_INIT_FAILED`) and video (`VO_INIT_FAILED`) output initialization failures with tailored troubleshooting messages. * Server Transcode Log Inspection: Added `getTranscodeFailureReason` in `ServerAdminRepository` to fetch and parse recent FFmpeg logs matching the failed media source, extracting and redacting error lines. * Enhanced Player Error Reporting: Updated `PlayerViewModel` to verify server reachability on stream load failures, differentiating between offline server, local playback errors, live channel drops, and server transcoding failures. * Admin Error Insights: For administrative sessions, playback error messages now asynchronously retrieve and append the server's transcode failure reason to the on-screen error prompt. * New String Resources: Added user-facing strings for video output errors, audio output errors, unavailable live channels, failed streams, and formatted server failure reasons.
MakD
marked this pull request as ready for review
October 14, 2026 22:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces jarnedemeulemeester's
dev.jdtech.mpv:libmpv:1.0.0with a custom build of the same library, published asio.github.makd:libmpv:1.1.0, which is compiled with Vulkan and HDR support. Thedev.jdtech.mpv.MPVLibAPI is unchanged, so this is close to a drop-in swap. With Vulkan available, the mpv GPU and HDR settings that were hidden in Player Options are turned back on.Changes
libmpv / rendering
libmpvdependency toio.github.makd:libmpv:1.1.0gpu-context=androidvkgpu-context=android+opengl-es=yeshwdec=mediacodecis promoted tomediacodec-copystop-playback-on-init-failure=yesso output init failures show up as errors instead of silently stallingSettings
Re-enabled the mpv options in Player Options:
Error diagnostics
end-fileerrors are now tracked; VO/AO init failures raise distinct error codes with steps the user can try (for example, "Try GPU API: OpenGL")Player
PlayerActivityhandlesonNewIntent, so a new playback request replaces the current one</>shortcuts are disabled on live channels, and speed resets to 1.0x when live playback startsHousekeeping
delay/withTimeoutOrNull/debouncecalls tokotlin.time.Durationacross the codebase