Skip to content

οΈπŸ›  - iOS audio session and background playbackΒ #79

@maxwellmattryan

Description

@maxwellmattryan

Description

Configure iOS audio session management for proper playback behavior. iOS requires explicit AVAudioSession configuration β€” HTML5 Audio in WKWebView does not automatically support background playback, lock screen controls, or audio interruption handling.

This is a prerequisite for the preview playback feature (#54) on mobile.

Scope:

  • Configure AVAudioSession category (.playback) via a Tauri iOS plugin or native Swift bridge
  • Add background audio entitlement (UIBackgroundModes: audio) in the Xcode project configuration
  • Handle audio interruptions:
    • Phone calls: pause playback, resume after call ends
    • Siri activation: duck or pause audio
    • Other apps playing audio: respond appropriately
  • Integrate MPNowPlayingInfoCenter for lock screen controls:
    • Display artwork, track name, artist name
    • Play/pause, previous/next track controls
    • Progress bar / scrubber
  • Handle audio route changes:
    • Bluetooth disconnect β†’ pause playback
    • Headphone unplug β†’ pause playback
    • Route change notification handling
  • Validate that the axum proxy (proxy.rs) continues serving audio data when the app is backgrounded
  • Ensure the Tokio runtime does not get suspended by iOS when audio is playing in the background

Key files:

  • Xcode project settings (entitlements, capabilities)
  • New Tauri iOS plugin or Swift bridge code
  • src-tauri/src/proxy.rs β€” validate background behavior

Open questions

  • Should audio session configuration be a Tauri plugin (reusable) or inline Swift code in the iOS project?
  • Does Tauri v2's iOS runtime keep the Tokio runtime alive during background audio playback, or does iOS suspend it?
  • How should MPNowPlayingInfoCenter receive track metadata β€” via Tauri IPC from the frontend, or directly from the Rust backend?

Acceptance criteria

  • Audio continues playing when the app is backgrounded or the screen is locked
  • Lock screen shows Now Playing controls with track info and artwork
  • Play/pause, previous/next controls work from the lock screen and Control Center
  • Audio pauses when a phone call is received and resumes after
  • Audio pauses when headphones are unplugged or Bluetooth disconnects
  • The axum proxy remains responsive during background playback

Tasks

TBD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions