Sending and Receiving AVPlayer HTTP Headers | Kevin James Hunt
While investigating a series of spikes in a certain error code for one of the video streaming iOS and tvOS apps I have been working on for my day job, we were asked by our CDN server team to inject and inspect the information being sent to and from the server during HLS streaming. In order to do this, we needed to add additional HTTP headers to the requests made by AVPlayer and grab the headers from the responses from the server. The idea being that the server will see the extra headers in requests and provide additional diagnostic information as headers in the response to the request. This proved to be an interesting challenge, as it turn out that Apple does not provide any APIs for doing this natively. Background To give some context, here is a brief introduction to HLS (HTTP Live Streaming) and why it is so useful on iOS and tvOS. There are many different types of streaming protocols that are used by apps and websites for delivering video content (i.e. a movie