How to handle basic HTTP authentication in AVURLAsset?

I am trying to create a custom movie player on iPhone using AVPlayer. But I'm just curious that if the m3u8 URL response sends an authentication request, how do I handle this. I really know about didReceiveAuthenticationChallenge and NSURLConnection, but I don't know how this works in this context.

Any help is appreciated.

-Soumya

+8
ios basic-authentication avplayer
source share
1 answer

We took a different approach to a similar problem, as we had to redirect to HTTP. We authenticated with cookies and set them for the whole domain:

NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys: kAuthCookieDomain, NSHTTPCookieDomain, kAuthCookiePath, NSHTTPCookiePath, kAuthCookieName, NSHTTPCookieName, kAuthCookieValue, NSHTTPCookieValue, kAuthCookieDiscard, NSHTTPCookieDiscard, nil]; NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:properties]; [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie]; 
0
source

All Articles