1

I'm implementing shouldWaitForLoadingOfRequestedResource handler for AVPlayer/AVURLAsset HLS videos and found a weird behavior in tvOS.

As I see it could request the same resources multiple times, including "root" manifest, second-level manifests and segments (and I'm talking not about multiple quality switches, it's requesting exactly the same resources).

In the same time, each request are served with my code well enough – video is playing good. Also, exactly the same code is working fine in iOS – no duplicated requests.

In which cases AVURLAsset/AVAssetResourceLoader could request the same resources multiple times in tvOS?

norlin
  • 1,205
  • 11
  • 24

1 Answers1

1

I have the same problem I can add that I'm using the apple sample app

public func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool {
  print("\(#function) was called in AssetLoaderDelegate with loadingRequest: \(loadingRequest)")
  var ret : Bool = true
  ret =  shouldLoadOrRenewRequestedResource(resourceLoadingRequest: loadingRequest)
  return ret
}

This is the debug print i get:

resourceLoader(_:shouldWaitForLoadingOfRequestedResource:) was called in AssetLoaderDelegate with loadingRequest: { URL: skd://817015000008100f172b492d3b25f5dda31c59d090b21000 }, request ID = 3, content information request = AVAssetResourceLoadingContentInformationRequest: 0x14f6dd070, content type = "(null)", content length = 0, byte range access supported = NO, disk caching permitted = NO, renewal date = (null), data request = AVAssetResourceLoadingDataRequest: 0x14f67ae50, requested offset = 0, requested length = 9223372036854775807, requests all data to end of resource = YES, current offset = 0

I can see each time the value request ID in the print is different

James Zaghini
  • 3,895
  • 4
  • 45
  • 61