1

I am streaming video from a server to iPhone using Http Live Streaming. I need to set certain headers in the http packets that the phone sends to the server.

For regular packets, the following code would suffice:

NSMutableURLRequest* request = [[[NSMutableURLRequest alloc] initWithURL:url]
                                autorelease];
[request setValue:VALUE forHTTPHeaderField:@"Field You Want To Set"];

Unfortunately, I did not find a similar API for MPMoviePlayerController. In other words, how do I force MPMoviePlayerController to set certain headers in the http packets that it uses to communicate to the server?

S B
  • 8,134
  • 10
  • 54
  • 108

3 Answers3

2

I think setting a cookie might solve your problem. Please look into the documentation for NSHTTPCookie and NSHTTPCookieStorage.

Soumya Das
  • 1,635
  • 2
  • 19
  • 28
  • +1 for suggesting a next-best workaround. However, I am still curious to find a solution that does not involve the server setting cookies proactively. – S B Jul 22 '11 at 19:28
  • I was able to accomplish this with a custom NSURLProtocol. Check out my solution: http://stackoverflow.com/a/24098761/107821 – hodgesmr Jun 07 '14 at 15:32
0

Recently, I had this problem too, and found from stack overflow that the solution is to use NSURLProtocol. Still, it was painful figuring out how to do it, so I thought I'd save people some time by sharing the coded solution: https://stackoverflow.com/a/23261001/3547099

Community
  • 1
  • 1
jacklehamster
  • 311
  • 3
  • 6
0

I don't think you'll find a solution other than using NSHTTPCookieStorage to have the client send cookie based headers to the server.

Tom M
  • 141
  • 2
  • 4