Skip to content

Commit

Permalink
[Blink>Media] Moving autoplay logic to AutoplayPolicy
Browse files Browse the repository at this point in the history
This CL moves autoplay code from HTMLMediaElement to the
AutoplayPolicy class, which helps decoupling the autoplay logic
from HTMLMediaElement.

BUG=712606

Review-Url: https://codereview.chromium.org/2813303005
Cr-Commit-Position: refs/heads/master@{#466137}
  • Loading branch information
xxyzzzq authored and Commit bot committed Apr 20, 2017
1 parent ac9a37e commit 12d76ad
Show file tree
Hide file tree
Showing 9 changed files with 480 additions and 291 deletions.
7 changes: 7 additions & 0 deletions docs/media/autoplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ There are two ways of initiating autoplay:
* Autoplay by `play()` method: Explicitly calling the `play()` method without
user gesture.

All the autoplay logic is handled by the AutoplayPolicy class. When the media
element wants to perform some action (like unmute, autoplay by attribute or
`play()` method), it will send a request to AutoplayPolicy, and if the request
is approved, the element can autoplay, otherwise it should be paused. Also the
media element should inform the AutoplayPolicy about relevant changes such as
"the element has been moved to a new document".

## User gesture lock

Each media element has a user gesture lock. If the element is allowed to
Expand Down
2 changes: 2 additions & 0 deletions third_party/WebKit/Source/core/html/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ blink_core_sources("html") {
"imports/HTMLImportsController.h",
"imports/LinkImport.cpp",
"imports/LinkImport.h",
"media/AutoplayPolicy.cpp",
"media/AutoplayPolicy.h",
"media/AutoplayUmaHelper.cpp",
"media/AutoplayUmaHelper.h",
"media/HTMLMediaElementControlsList.cpp",
Expand Down
Loading

0 comments on commit 12d76ad

Please sign in to comment.