Skip to content

feat: allow setting autoplayPolicy in webPreferences - #16396

Merged
nornagon merged 4 commits into
chromium-upgrade/72from
autoplay-policy
Jan 15, 2019
Merged

nornagon merged 4 commits into
chromium-upgrade/72from
autoplay-policy

Conversation

@nornagon

@nornagon nornagon commented Jan 14, 2019 •

Copy link
Copy Markdown
Contributor

Description of Change

Chrome 71 shipped with the autoplay policy set to require user gesture by default. I don't think this default makes sense for electron, so I've made the default in electron be kNoUserGestureRequired, but I can imagine app devs wanting to set a different option. This exposes that API as {autoplayPolicy: "user-gesture-required"} in webPreferences.

Checklist

Release Notes

Notes: Allowed configuring of media autoplay policy via webPreferences.

@nornagon
nornagon requested review from a team and MarshallOfSound January 14, 2019 20:56
@nornagon

This comment has been minimized.

@nornagon
nornagon requested a review from a team January 14, 2019 21:22
@nornagon nornagon removed the wip ⚒ label Jan 14, 2019
Comment thread docs/api/browser-window.md Resolved
@nornagon
nornagon force-pushed the chromium-upgrade/72 branch from 45b7838 to 4910487 Compare January 14, 2019 23:03

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

prefs->navigate_on_drag_drop =
IsEnabled("navigateOnDragDrop", false /* default_value */);
prefs->autoplay_policy = content::AutoplayPolicy::kNoUserGestureRequired;
GetAsAutoplayPolicy(&preference_, "autoplayPolicy", &prefs->autoplay_policy);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be

if (!GetAsAutoplayPolicy(&preference_, "autoplayPolicy", &prefs->autoplay_policy)) {
  prefs->autoplay_policy = content::AutoplayPolicy::kNoUserGestureRequired;
}

@nornagon
nornagon merged commit 95dad57 into chromium-upgrade/72 Jan 15, 2019
@release-clerk

release-clerk Bot commented Jan 15, 2019

Copy link
Copy Markdown

Release Notes Persisted

Allowed configuring of media autoplay policy via webPreferences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants