diff --git a/sdk/sourcefiles/internal/ANWebView.m b/sdk/sourcefiles/internal/ANWebView.m index 5509fc660..885add8ac 100644 --- a/sdk/sourcefiles/internal/ANWebView.m +++ b/sdk/sourcefiles/internal/ANWebView.m @@ -155,36 +155,22 @@ + (void) addDefaultWebViewConfiguration configuration.processPool = anSdkProcessPool; configuration.allowsInlineMediaPlayback = YES; - - // configuration.allowsInlineMediaPlayback = YES is not respected - // on iPhone on WebKit versions shipped with iOS 9 and below, the - // video always loads in full-screen. - // See: https://bugs.webkit.org/show_bug.cgi?id=147512 - if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { - if (@available(iOS 10.0, *)) { - configuration.mediaTypesRequiringUserActionForPlayback = NO; - }else { - configuration.requiresUserActionForMediaPlayback = NO; - } - + + if (@available(iOS 10.0, *)) { + configuration.requiresUserActionForMediaPlayback = NO; + configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio; } else { - if ( [[NSProcessInfo processInfo] respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)] - && [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10,0,0}] ) - { - if (@available(iOS 10.0, *)) { - configuration.mediaTypesRequiringUserActionForPlayback = NO; - }else { - configuration.requiresUserActionForMediaPlayback = NO; - } + // configuration.allowsInlineMediaPlayback = YES is not respected + // on iPhone on WebKit versions shipped with iOS 9 and below, the + // video always loads in full-screen. + // See: https://bugs.webkit.org/show_bug.cgi?id=147512 + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { + configuration.requiresUserActionForMediaPlayback = NO; } else { - if (@available(iOS 10.0, *)) { - configuration.mediaTypesRequiringUserActionForPlayback = YES; - }else { - configuration.requiresUserActionForMediaPlayback = YES; - } + configuration.requiresUserActionForMediaPlayback = YES; } } - + WKUserContentController *controller = [[WKUserContentController alloc] init]; configuration.userContentController = controller;