Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Response header from AVPlayer

Tags:

ios

avplayer

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.

like image 304
Dvyz Avatar asked Nov 08 '22 21:11

Dvyz


1 Answers

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

like image 88
Kevin James Hunt Avatar answered Nov 15 '22 07:11

Kevin James Hunt