I am trying to transfer an audio file from a server protected by session-based verification and I noticed that both MPMoviePlayerController and AVPlayerItem / AVPlayer do not use cookies set in NSHTTPCookieStorage. If I make the same URL request using NSURLConnection, I get 200 and can access the audio file. When I track requests through a proxy, it looks like MPMoviePlayerController does not set a cookie in the request header, but NSURLConnection does:
Request with MPMoviePlayerController initWithContentURL :
GET /path/on/server/test1.m4a HTTP/1.1 Host: server.example.net User-Agent: AppleCoreMedia/1.0.0.9A334 (iPhone Simulator; U; CPU OS 5_0 like Mac OS X; en_us) Accept: */* Range: bytes=0-1 Accept-Encoding: identity X-Playback-Session-Id: E8F093F4-C906-46A8-94FE-30BBCFDAB3F6 Connection: keep-alive
Request with NSURLConnection:
GET /path/on/server/test1.m4a HTTP/1.1 Host: server.example.net User-Agent: otest (unknown version) CFNetwork/548.0.3 Darwin/11.1.0 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate Cookie: somekey=abc123def456 Connection: keep-alive
Does anyone know how to force MPMoviePlayerController or AVPlayerItem to use NSHTTPCookie when requesting a remote resource?
source share