Skip to content

Commit

Permalink
MS-4719 DisableAutoplay Sound
Browse files Browse the repository at this point in the history
* commit '32764fce8964b87eca3aae5dea33e2083d8da41e':
  Update ANWebView.m
  Update ANSDKSettings.m
  Update ANSDKSettings.h
  Add enableAutoplayWithSound flag to ANSDKSettings
  • Loading branch information
asharmaa committed Apr 15, 2021
2 parents 613625c + 32764fc commit 9516d23
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions sdk/sourcefiles/internal/ANWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9516d23

Please sign in to comment.