Skip to content

How does Cup's WebView audio behave on the iOS simulator? #374

Closed

Description

@patricktree

Question

On the mobile E2E suite's iOS simulator, how does Cup's WebView <audio> playing a narration track behave in the respects a simulator can show?

  • Now Playing in Control Center and on the lock screen with WebKit's defaults: title, artwork, duration, position, scrubbing, play, pause and skip.
  • Whether navigator.mediaSession action handlers and setPositionState take effect and change what Now Playing shows.
  • Whether the signed track URL's range requests from capacitor://localhost return 206 and keep working through a whole listen, including after a seek near the end.
  • What happens to playback and to CapacitorHttp requests when the simulator locks or Cup goes to the background. Note where the simulator is known to differ from a device; Does Cup keep playing and saving the listening position through a long locked listen on a physical iPad? covers that.

The WebView research explains the source-level expectations, and its device experiments 1 and 4 are the device counterparts.

Activity

  1. self-assigned this
    on Nov 14, 2026
  2. patricktree commented on Nov 14, 2026

    @patricktree
    CollaboratorAuthor

    Answer

    Research doc: WebView audio on the iOS simulator on branch research/ios-simulator-webview-audio (no pull request), with a probe archive. Observed on the mobile E2E suite's simulator (iPhone 17, iOS 27.2 24B8117, Xcode 27.2 27B52, macOS 27.2) with the debug shell against the local test Worker and fake auth provider, playing a 3:48 test narration track.

    • Now Playing with WebKit's defaults: WebKit's GPU process publishes title, duration, elapsed time, rate and the 256 × 256 artwork to MediaRemote. The lock screen shows title, scrubber with elapsed and remaining time, Rewind 10 s, Play/Pause, Fast-forward 10 s; no next/previous track. Play, Pause and the 10-second skips work and drive the <audio> element directly. The artwork showed as a grey placeholder, and the simulator's Control Center has no Now Playing module, so neither could be checked. Scrubbing with the defaults was not exercised.
    • navigator.mediaSession: registered play, pause, seekto, seekforward and seekbackward handlers receive the lock-screen commands (skips with seekOffset 10, scrubbing as seekto with fastSeek false); the buttons stay the same. setPositionState replaces what the lock screen shows (a bogus 1800 of 3600 s showed 30:00 of 1:00:00), so Cup must keep it current once it sets it.
    • Range requests: from capacitor://localhost the signed track URL gets bytes=0-1 and bytes=0-3660287, both 206. Over the loopback that one response holds the whole track. Through a throttling proxy, a seek near the end past the buffered part issued new range requests (bytes=3522560-…), all 206, and the track played to its end; a locked listen through 24 KiB/s also played to its end.
    • Lock and background: locked, audio, page timers, CapacitorHttp requests and Cup's position saves (PUT …/position, 204) kept running to the end of the track; in the background with playback paused, timers and CapacitorHttp kept running for 75 s too. This is a simulator artefact: about 30 s after locking, RunningBoard calculated Cup's app process, WebContent and Networking processes as running-suspended (only the GPU process stayed active) and logged Ignoring suspend because this process is simulated and has background audio capabilities. On a device those states predict that page JS, CapacitorHttp and media loads past the buffer may stop while audio continues.

    For the physical-iPad ticket (#375)

    • A locked listen of a track of at least 60 minutes over the real network, past what was buffered before locking (Networking process suspension).
    • Whether position saves keep reaching the server while locked and when they stop; log stream with process == "runningboardd" AND eventMessage CONTAINS "audio.cup.app" shows the real process states.
    • Lock-screen artwork (grey placeholder on the simulator).
    • Control Center's Now Playing module (not available on the simulator).
    • Lock-screen scrubbing with WebKit's defaults.
    • Headphones disconnecting, a call, another app starting playback.
    • The UIBackgroundModes audio variant: it is what made RunningBoard skip the suspension on the simulator, so its effect on a device is open.

    Not needed on the device: Now Playing title, duration and position, Play/Pause and 10-second skips with the defaults, mediaSession handlers and setPositionState taking effect, and 206 range responses from capacitor://localhost, unless iPadOS behaves differently from iOS 27.2.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions