Adding HTTP headers to a AVURLAsset

Hi,
for the implementation of an audio player with signed URL's, I need to be able to set an authorization header to the request for an AVURLAsset.
This works but not on Airplay when trying to stream multiple songs in a queue.

For each item I do:

Code Block swift
let headerFields: [String: String] = ["Authorization": getIdToken()!]
super.init(url: url, options: ["AVURLAssetHTTPHeaderFieldsKey": headerFields])


But only the first 2 songs in the queue actually get this authorization header sent along, somehow it is removed for subsequent songs.

Any ideas on how I can fix this?

thanks,
Thomas

Hello @thomas.vansundert, thank you for your post. Please see this thread.

Please also note that AVURLAssetHTTPHeaderFieldsKey is not a supported API, so you should not use it.

Adding HTTP headers to a AVURLAsset
 
 
Q