Skip to content

ParaverseTechnology/lark_sr_webview_ios

Repository files navigation

LarkSR - ios wkwebview demo

Show ios webview open LarkSR Web client.

Links:

Paraverse

LarkSR Doc

Experience

Code

notice: use WKWebView not UIWebView

WKWebView Config

// create config
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];

// request, makesure play video inline mode.
config.allowsInlineMediaPlayback = YES;

// requst, auto play video
config.requiresUserActionForMediaPlayback = NO;
config.mediaTypesRequiringUserActionForPlayback = NO;

Ignore certificate verification

LarkSR support HTTPS, but if a self-signed certificate load failed, can igonre certificate verification

Setup WKNavigationDelegate

// Ignore certificate verification
-(void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{
    
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
        NSURLCredential *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust];
        completionHandler(NSURLSessionAuthChallengeUseCredential,card);
    }
}

About

iOS webview openLarkSR webclient

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published