Skip to content

feat(android): add Erika native playback with SAF and HDR support#740

Merged
MCDFsteve merged 16 commits into
AimesSoft:mainfrom
Shinokawa:codex/erika-android-support
Jul 17, 2026
Merged

feat(android): add Erika native playback with SAF and HDR support#740
MCDFsteve merged 16 commits into
AimesSoft:mainfrom
Shinokawa:codex/erika-android-support

Conversation

@Shinokawa

@Shinokawa Shinokawa commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Integrate Erika's Android PlatformView and native video surface into Nipa.
  • Add Erika player selection, SDR / Extended Linear HDR output control, and live decoder, audio, presenter, output, and error diagnostics.
  • Support Android SAF content:// video sources through Erika's owned file-descriptor path without copying media; selected SAF subtitles remain file-backed through an app-owned cache copy.
  • Serialize player hot swaps and await native teardown so old and replacement players cannot overlap.
  • Make backend disposal idempotent, add a bounded teardown gate with explicit timeout/failure logs, and harden asynchronous fullscreen/dialog lifecycle callbacks.
  • Handle EOF pause races and deterministic media-open failures without unbounded recovery loops.
  • Build the pinned Erika Android runtime from source in CI for every supported ABI.

Dependency

This PR depends on AimesSoft/Erika#42:

Runtime validation

Validated on a Pixel 8 / API 36 x86_64 emulator with the current Erika pin lineage:

  • Connected to the local Jellyfin server and successfully played episode 11 through MediaCodec + wgpu + AAudio.
  • Loaded and rendered 2,877 danmaku items through Erika.
  • Default 20 logical-pixel danmaku renders at about 52.5 physical pixels with DPR 2.625; Nipa fontSize / isMe payload compatibility is covered by Erika.
  • No native attach, resize, or surface-recovery errors were observed during the playback smoke test.
  • SAF playback reaches Erika through its owned descriptor path; unsupported hardware/output cases emit explicit diagnostics and use the configured fallback path.

Checks

  • Full Flutter suite on Windows: 129 passed, 10 skipped.
  • flutter analyze --no-pub --no-fatal-infos --no-fatal-warnings lib test: exit code 0; remaining warnings/info are pre-existing repository diagnostics.
  • The two library-management widget failures introduced by upstream PR Fix/floder name display #744 are fixed in a separate test-only commit by supplying the new AppearanceSettingsProvider dependency.
  • Erika dependency head: all 8 CI checks pass, including macOS Rust, iOS staticlib, Windows x64, and all four Android ABIs.
  • Android Kotlin/native assemble, install, startup, SAF, software fallback, rendering, screenshot, Jellyfin playback, and danmaku smoke paths have been exercised during development.

Cross-platform review status

  • Android output mode arguments are only sent on Android; macOS/iOS/Windows retain Erika's previous output behavior.
  • Android SAF and Kotlin activity code are platform-isolated.
  • Shared disposal/hot-swap changes prevent duplicate backend teardown and abort replacement creation after a teardown failure or timeout.
  • Shared Flutter changes have passed the full Windows-hosted test suite; native Apple/Windows behavior is also protected by Erika's macOS, iOS, and Windows CI jobs.
  • Erika review follow-ups make play non-blocking, bound stalled subtitle subscribers with structured diagnostics, remove a D3D11 panic path, and document the C API physical-pixel migration.

Known limitation

Some providers opening files through Android ACTION_VIEW grant only temporary read access and do not offer a persistable URI grant. Playback works while that grant remains valid, but reopening the item from history after a process restart may fail. Nipa logs this condition explicitly. Files selected through ACTION_OPEN_DOCUMENT retain permission when the provider supports persistable grants.

Do not merge this PR until review is complete.

@Shinokawa
Shinokawa force-pushed the codex/erika-android-support branch 2 times, most recently from 2291530 to 0f2312f Compare July 15, 2026 10:10
@Shinokawa
Shinokawa force-pushed the codex/erika-android-support branch from 3855225 to 2a80d5e Compare July 16, 2026 18:45
@Shinokawa
Shinokawa marked this pull request as ready for review July 17, 2026 04:37
@Shinokawa
Shinokawa requested a review from a team as a code owner July 17, 2026 04:37
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@FurudeRika123 FurudeRika123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erika PR #42 has been successfully merged, and the latest Erika commit pin 0ca2a45 has resolved the previous blocker feedback. The PR validation and release CI checks for NipaPlay-Reload PR #740 are passing. LGTM! Approve merging this branch.

@MCDFsteve
MCDFsteve merged commit 09f8e1a into AimesSoft:main Jul 17, 2026
4 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.

3 participants