I have a special use case where I need to track a response header from AVPlayer while it is streaming an HLS playlist. I searched in the internet and read the AVPlayer documentation and did not find any specific way to get this. I know that there is a way to get the HTTP response headers from the request made by the app but I could not find anything to get the response header for the requests made by the AVPlayer.
I spent weeks looking for a way to do this for both requests and responses for the playlist and chunk requests. The only way I was able to find that worked was by passing the playback request through a reverse proxy on the device. This allows you to intercept the request, add headers, send it to the real server, and then extract the headers from the response before returning it to the AVPlayer.
I made a simple example project (with lots of comments and documentation) here: https://github.com/kevinjameshunt/AVPlayer-HTTP-Headers-Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With