如何在AVURLAsset中处理HTTP基本身份验证?

Sou*_*Das 8 http basic-authentication ios avplayer

我正在尝试使用AVPlayer在iPhone中开发自定义电影播放器​​.但我只是想知道如果m3u8 url响应发回验证质询,我该如何处理.我确实知道didReceiveAuthenticationChallenge和NSURLConnection,但没有关于它在这种情况下如何工作的线索.

任何帮助表示赞赏.

-Soumya

Dan*_*uke 0

我们对类似问题采取了不同的方法,因为我们也必须遵守 HTTP 中的重定向。我们在 cookie 中进行身份验证并将其设置为整个域:

NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
                            kAuthCookieDomain, NSHTTPCookieDomain,
                            kAuthCookiePath, NSHTTPCookiePath,
                            kAuthCookieName, NSHTTPCookieName,
                            kAuthCookieValue, NSHTTPCookieValue,
                            kAuthCookieDiscard, NSHTTPCookieDiscard,
                           nil];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:properties];  
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
Run Code Online (Sandbox Code Playgroud)