Repository navigation
Description
What should the engine do?
Provide an opt-in persistent cache of original HTTP(S) source-byte ranges that can be reused across playback sessions and app launches. A host-supplied stable resource identity should allow reuse when a signed URL changes, while content-version or HTTP-validator checks prevent serving stale bytes.
Motivating media or use case
ZICAN is an iOS/iPadOS and macOS host using AetherEngine for playback. The motivating sources are progressive remote MP4/MKV files resolved by a media provider (for example Emby), sometimes through redirects to short-lived signed CDN URLs.
The desired sequence is:
- Playback or prewarm fetches a range of a media resource.
- The user stops playback, leaves the media, or restarts the app.
- The provider resolves the same underlying resource to a fresh URL.
- After establishing that the representation is still valid, the next playback reuses committed cached ranges and fetches only missing ranges.
This would reduce repeated transfers and reopening latency. This is a capability request based on the documented cache lifetime, not a measured performance regression; no new benchmark or restart test result is claimed here.
Existing behavior and references
- #551 documents session-scoped disk caching and explicitly excludes persistence across app launches from its prewarm scope. The subsequently released prewarm API addresses warming before load, but does not add this persistent lifetime.
- #703 contributes persistent sparse source-range caching, stable host keys and asynchronous writes. It is still unmerged. The maintainer response asks for focused opt-in contributions with existing defaults preserved and the full suite passing; it does not promise acceptance of the cache portion.
- KSPlayer's feature table lists hard-drive precaching as a paid capability. Its author describes a CacheIOContext approach that stores fetched bytes locally and checks coverage before reading from the origin. This is a product/architecture reference only, not evidence that KSPlayer satisfies stable-key, restart or validator requirements. The #796 discussion also states that its implementation does not support m3u8; that statement is from 2024.
Proposed initial scope and acceptance criteria
The API names, storage format and capacity defaults are open to maintainer guidance. A focused first version could cover engine-owned HTTP source reads for progressive VOD, with the following behavior:
- Persist original source bytes rather than remuxed session segments; retain the current behavior when the feature is disabled or no stable identity is supplied.
- Separate resource identity from signed URLs and credentials. Do not persist source URLs, authorization headers, cookies or play-session tokens; keep different provider/account scopes isolated.
- Require a trusted immutable revision or origin revalidation before cross-session reuse. A size-only match must not be treated as proof that content is unchanged.
- Validate HTTP range responses and never merge bytes from mismatched representations or place an ignored nonzero Range response at the requested offset.
- Keep writes asynchronous and bounded. Disk errors, corrupt/missing cache files and full write queues must degrade to cache misses or dropped writes without introducing playback errors.
- Bound disk usage and provide safe clearing/eviction while active readers remain protected. Recover only committed valid ranges after restart.
Native remote HLS, offline-download guarantees and background downloading can stay outside this initial request.
Questions for maintainers
Would you consider this capability in upstream AetherEngine as an independent, opt-in feature? Could the source-cache portion of #703 be a starting point for a focused contribution, and which API/validation/lifecycle changes would you require? Alternatively, would you prefer hosts to provide this through the existing custom IOReader boundary?
This issue requests a scope decision and does not assume a delivery date or that the current #703 implementation will be accepted unchanged.
Area
Public API surface
Host app / integration context
ZICAN (iOS/iPadOS and macOS); declared dependency updated to AetherEngine 7.28.0.
Would you be willing to open a PR?
Maybe, with guidance. Seeking maintainer feedback on scope and ownership first; no implementation PR is committed at this stage.
Activity
superuser404notfound commentedon Oct 6, 2026
Thanks for the careful write-up, and for ruling out size-only matching yourself.
I'm going to keep this out of the engine. A persistent cache that is safe across launches needs validator tracking (which the engine does not do today), eviction alongside active readers, crash recovery and a cross-engine disk budget. That is a permanent maintenance surface for "wrong bytes" bugs. And the part that makes it correct, knowing that two signed URLs name the same unchanged file, is knowledge only the host has. The engine would have to take the host's word for it anyway.
The boundary I'd recommend is a small loopback HTTP proxy in the host rather than a custom
IOReader: load.url(http://127.0.0.1:<port>/<stable-key>)and let the proxy answer Range requests from its cache, resolving the provider's fresh signed URL for the misses. The engine keeps its whole remote-source path (range handling, prewarm, the Cues tail, range-ignore detection, retries) against the proxy unchanged, and the identity, revision and validation policy live where the knowledge is. A customIOReaderalso works, but it bypasses that path.If the proxy approach runs into something the engine does that defeats caching (an access pattern, a header, a missing hook), please open an issue with the request log, and I'll look at fixing that in the engine.