AVMetricMediaResourceRequestEvent returns error but no URLSession metrics for failed HLS playlist/segment requests

Hello,

I am using AVMetrics to monitor HLS playback requests from AVPlayer, specifically AVMetricHLSPlaylistRequestEvent and AVMetricHLSMediaSegmentRequestEvent.

These events provide an AVMetricMediaResourceRequestEvent. For successful requests, I can read URLSession metrics. However, when a request fails, the event contains an error but no URLSession metrics.

I reproduced this by intercepting HLS playlist and segment requests with Charles Proxy and forcing failures on both the simulator and a physical device.

Is this expected behavior? If so, is there any supported way to get timing details for failed HLS requests?

I am using code like this:

for try await event in playerItem.metrics(forType: AVMetricHLSPlaylistRequestEvent.self) {
    // ...
}

for try await event in playerItem.metrics(forType: AVMetricHLSMediaSegmentRequestEvent.self) {
    // ...
}

Also, the example shown in the WWDC session does not compile for me (XCode 26.2). I get the following error:

Pack expansion requires that '' and 'AVMetricEvent' have the same shape

let playerItem: AVPlayerItem = ...

let ltkuMetrics = item.metrics(forType: AVMetricPlayerItemLikelyToKeepUpEvent.self)
let summaryMetrics = item.metrics(forType: AVMetricPlayerItemPlaybackSummaryEvent.self)

for await (metricEvent, publisher) in ltkuMetrics.chronologicalMerge(with: summaryMetrics) {
    // send metricEvent to server
}
AVMetricMediaResourceRequestEvent returns error but no URLSession metrics for failed HLS playlist/segment requests
 
 
Q