Skip to content

[HLSLiveIngestReader / nativeRemoteHLS] Live HLS playback fails on tokenized/header-enforcing IPTV streams over redirects #363

Description

@parthp1808

What happened?

Summary

When attempting live playback of tokenized IPTV HLS streams (.m3u8) requiring custom httpHeaders (User-Agent / STB profile headers) across cross-origin HTTP 302 redirects:

  1. nativeRemoteHLS: true fails because Apple's AVPlayer / AVURLAsset drops custom HTTP request headers when following cross-origin redirects to edge CDN nodes, resulting in origin HTTP 401 Unauthorized / 403 Forbidden errors (ProviderError / AVFoundationErrorDomain).
  2. nativeRemoteHLS: false (raw live path) fails closed with hlsPlaylistOnRawLivePath ([AVIOReader] HLS playlist body on the raw live path (AE#140); failing closed. Use LoadOptions.nativeRemoteHLS or HLSLiveIngestReader for m3u8 sources).
  3. HLSLiveIngestReader(playlistURL:httpHeaders:) terminates with HLSIngestError when encountering variant structures, non-TS media segments, or redirect token parameters.

Expected Behavior

Live .m3u8 streams requiring httpHeaders should be playable via HLSLiveIngestReader or nativeRemoteHLS without losing custom headers across redirects or failing closed on the raw path.

Actual Behavior

  • nativeRemoteHLS: true -> AVPlayer drops headers on 302 redirect -> Origin returns HTTP 401/403.
  • nativeRemoteHLS: false -> hlsPlaylistOnRawLivePath error (AetherEngine#140).
  • HLSLiveIngestReader -> Terminates with HLSIngestError.

Logs

[portal.raw-response] ... data={"js":{"id":"1432","cmd":"http:\/\/glen.packetcdn.me:9324\/86e4228d...\/index.m3u8?token=2be67cd6..."

[com.orvix.tv:playbackSession] [INFO] Attempting playback on candidate engine [aether]
[com.orvix.tv:aether] [INFO] Preparing stream; isHLS: true, live: true, nativeRemoteHLS: false, liveJoinProfile: fastZap, header count: 1
[AVIOReader] pump conn start gen=1 offset=0 open-ended
[AVIOReader] pump gen=1 first data after 11ms
[AVIOReader] HLS playlist body on the raw live path (AE#140); failing closed. Use LoadOptions.nativeRemoteHLS or HLSLiveIngestReader for m3u8 sources.
[AetherEngine] probe failed (HLS playlist supplied to the raw live path); proceeding without criteria
[com.orvix.tv:aether] [ERROR] Aether playback phase error: HLS playlist supplied to the raw live path. Use LoadOptions.nativeRemoteHLS or HLSLiveIngestReader for m3u8 sources.


### Steps to reproduce

1. Obtain an IPTV live channel URL returning an `.m3u8` playlist that issues a 302 redirect to a CDN node requiring custom HTTP headers (e.g., User-Agent or Authorization).
2. Configure `LoadOptions`:
   let options = LoadOptions(
       httpHeaders: ["User-Agent": "Mozilla/5.0 (QtEmbedded; ...)"],
       isLive: true,
       nativeRemoteHLS: true
   )
3. Call `try await engine.load(url: streamURL, options: options)`.
4. Observe that AVPlayer drops the custom HTTP headers on the cross-origin redirect, causing the stream server to return HTTP 401/403 (`authenticationFailed`).
5. Alternatively, call `engine.load(url: streamURL, options: LoadOptions(isLive: true, nativeRemoteHLS: false))` and observe `hlsPlaylistOnRawLivePath` (AetherEngine#140).


### AetherEngine version or commit SHA

6.21.0

### Host app

Custom / my own integration

### Platform

iOS

### OS version

ios 26.5

### Device / chip

iPhone 17 Pro (Xcode simulator)

### Playback path

Native AVPlayer

### Source media (for playback bugs)

_No response_

### Error codes / log lines

```text

Anything else

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions