Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable default user gesture requirement for audio playback on Mac
https://bugs.webkit.org/show_bug.cgi?id=157820

Reviewed by Sam Weinig.

Disable the WebPreferences and matching WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback
settings on Mac (and other non-iOS ports).

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):

Canonical link: https://commits.webkit.org/175989@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed May 18, 2016
1 parent 44cff6b commit 58c2465
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
14 changes: 14 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,17 @@
2016-05-18 Jer Noble <jer.noble@apple.com>

Disable default user gesture requirement for audio playback on Mac
https://bugs.webkit.org/show_bug.cgi?id=157820

Reviewed by Sam Weinig.

Disable the WebPreferences and matching WKWebViewConfiguration.mediaTypesRequiringUserActionForPlayback
settings on Mac (and other non-iOS ports).

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):

2016-05-18 Alex Christensen <achristensen@webkit.org>

Build fix when not using CredentialStorage with NetworkSession.
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit2/Shared/WebPreferencesDefinitions.h
Expand Up @@ -56,12 +56,10 @@
#define DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED true
#define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED true
#define DEFAULT_PDFPLUGIN_ENABLED true
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_AUDIO_PLAYBACK true
#else
#define DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED false
#define DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED false
#define DEFAULT_PDFPLUGIN_ENABLED false
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_AUDIO_PLAYBACK false
#endif

#if PLATFORM(IOS)
Expand All @@ -78,6 +76,7 @@
#define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY false
#define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM false
#define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED false
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_AUDIO_PLAYBACK true
#else
#define DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED true
#define DEFAULT_FRAME_FLATTENING_ENABLED false
Expand All @@ -92,6 +91,7 @@
#define DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY true
#define DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM true
#define DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED true
#define DEFAULT_REQUIRES_USER_GESTURE_FOR_AUDIO_PLAYBACK false
#endif

#if PLATFORM(IOS_SIMULATOR)
Expand Down
9 changes: 5 additions & 4 deletions Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Expand Up @@ -136,14 +136,15 @@ - (instancetype)init
_allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
_inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
_mediaDataLoadsAutomatically = NO;
#else
_mediaDataLoadsAutomatically = YES;
_userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
#endif
if (linkedOnOrAfter(WebKit::LibraryVersion::FirstWithMediaTypesRequiringUserActionForPlayback))
_mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio;
else
_mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
#else
_mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
_mediaDataLoadsAutomatically = YES;
_userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
#endif
_mainContentUserGestureOverrideEnabled = NO;
_invisibleAutoplayNotPermitted = NO;

Expand Down

0 comments on commit 58c2465

Please sign in to comment.