Website autoplay policies passed to the web frame loader should be respected by media elements. This is take 2 of https://bugs.webkit.org/show_bug.cgi?id=167132 with follow-up work from https://bugs.webkit.org/show_bug.cgi?id=167325 and fixes introduced in https://bugs.webkit.org/show_bug.cgi?id=167346 . If non-default autoplay policies are passed during navigation, prefer those to global preferences. If not, use the values specified in document settings.
Created attachment 299566 [details] Patch
Comment on attachment 299566 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299566&action=review > Source/WebCore/loader/DocumentLoader.h:471 > + std::optional<bool> m_audioPlaybackRequiresUserGesture; > + std::optional<bool> m_videoPlaybackRequiresUserGesture; I think this should be a 3-state enum, probably with a different name like m_audioPlaybackPolicy. enum class AutoplayPolicy { RequireUserGesture, AutoPlay, AutoPlayWithoutSound, Default, <-- This name might need to be more descriptive indicating that the policy hasn't been set by the WebsitePolicies so default to the Settings value. Maybe just a comment explaining this. etc. } These two could probably even be made into one enum > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:820 > +#if PLATFORM(MAC) Let's get rid of this now that it doesn't do anything for other platforms. > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:823 > + documentLoader->setAudioPlaybackRequiresUserGesture(std::optional<bool>()); std::nullopt
Created attachment 299613 [details] Patch
(In reply to comment #2) > Comment on attachment 299566 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299566&action=review > > > Source/WebCore/loader/DocumentLoader.h:471 > > + std::optional<bool> m_audioPlaybackRequiresUserGesture; > > + std::optional<bool> m_videoPlaybackRequiresUserGesture; > > I think this should be a 3-state enum, probably with a different name like > m_audioPlaybackPolicy. > enum class AutoplayPolicy { > RequireUserGesture, > AutoPlay, > AutoPlayWithoutSound, > Default, <-- This name might need to be more descriptive indicating that > the policy hasn't been set by the WebsitePolicies so default to the Settings > value. Maybe just a comment explaining this. > etc. > } > These two could probably even be made into one enum Done. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:820 > > +#if PLATFORM(MAC) > > Let's get rid of this now that it doesn't do anything for other platforms. Okay, and I made the tests run on iOS as well. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:823 > > + documentLoader->setAudioPlaybackRequiresUserGesture(std::optional<bool>()); > > std::nullopt Not necessary with the changes above.
Comment on attachment 299613 [details] Patch Clearing flags on attachment: 299613 Committed r211097: <http://trac.webkit.org/changeset/211097>
All reviewed patches have been landed. Closing bug.
*** Bug 167346 has been marked as a duplicate of this bug. ***
*** Bug 167132 has been marked as a duplicate of this bug. ***
*** Bug 167325 has been marked as a duplicate of this bug. ***