Skip to content

Enable Android background audio and update to 1.6.9 - #6

Open
johnwan wants to merge 2 commits into
MoonTechLab:mainfrom
johnwan:codex/android-background-audio-1.6.9
Open

johnwan wants to merge 2 commits into
MoonTechLab:mainfrom
johnwan:codex/android-background-audio-1.6.9

Conversation

@johnwan

@johnwan johnwan commented Oct 23, 2026 •

Copy link
Copy Markdown

Videos currently pause when Android moves the app into the background. This change adds optional screen-off audio playback and Android media controls, while keeping the existing player and playback position.

Changes

  • Add a persistent 后台播放 (background playback) switch to Android settings, enabled by default. Disabling it pauses hidden/screen-off playback and blocks background resume; returning to the app does not automatically resume.
  • Connect the existing media_kit player to an audio_service foreground service for on-demand and live playback, preserving media, position, and speed.
  • Add play/pause/stop controls and on-demand seeking. Size and center the Stop glyph to match Android's Play/Pause controls. Handle audio-focus loss and unplugged headphones, and release foreground playback and wake locks when paused, stopped, completed, or closed.
  • Update Gradle to 9.8.2 (with SHA-256 verification), AGP to 9.4.1, Kotlin to 2.4.21, Java/Kotlin bytecode to 17, and native modules to stable NDK 30.0.16248370.
  • Upgrade Flutter dependencies to their newest mutually compatible releases, require Flutter >=3.47 / Dart >=3.13, and bump the app to 1.6.9+4159.
  • Add regression tests, a device playback harness, build notes, and an optional application-ID suffix for separate test installations.

Validation

  • flutter test --no-pub: all 14 tests passed, including persistence, disabled-background resume, and replacement-player ownership.
  • Focused flutter analyze --no-pub on the changed code and tests: no issues. git diff --check passed.
  • Android ARM64 debug APK built and installed on the connected Android 17 phone.
  • Toggle OFF: playback paused on screen-off, remote Play remained paused, and returning to the app did not auto-resume.
  • Toggle ON: sample playback advanced from 148.166s to 158.291s while dozing.
  • Actual notification Pause/Play/Stop buttons worked; Stop cleared active playback and foreground service state. Verified the resized Stop icon on the phone.
  • Existing earlier checks: both repository shell regression tests passed; closing the widget cleared its media session.

Device screenshots

Captured on the connected Android phone using the production player and settings menu in the smoke harness, with a fresh test profile and Big Buck Bunny sample media. The temporary screenshot installation was removed after testing.

Notification playback controls Background playback setting
Android media controls with matching Stop and Pause icons Background playback enabled in Selene settings

Compatibility

Keep the Flutter compatibility flags for the legacy Android DSL and Kotlin plugin while dependencies still require them. package_info_plus and xml remain on their newest resolvable versions. Network live streams, incoming calls, release builds, and non-Android platform builds have not been device/build validated.

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