Related videos on YouTube (and YouTube playlists) cause media controls to disappear
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2016 19:39:45 +0000 (19:39 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2016 19:39:45 +0000 (19:39 +0000)
commit9def0a3694b266e7ab0bb8e19e2146fae3d45c03
treef20d1690fe29ead16b0c73dbc7f8adf8151a96d4
parentda739b2d09f947c2454900dfffe87a5e423ca68a
Related videos on YouTube (and YouTube playlists) cause media controls to disappear
https://bugs.webkit.org/show_bug.cgi?id=162621
<rdar://problem/28484193>

Reviewed by Jer Noble.

Tweaks the main content media heuristic for better Now Playing behavior on YouTube by making the following
changes:
- Remove the strict requirement for audio to be actively playing for the session to be able to show
  controls for the purpose of Now Playing, making it the same as our policy for the controls manager.
- Make playback requirement restrictions apply only for the controls manager. Videos that do not
  autoplay will still have the correct behavior with respect to Now Playing, since we will bail in the
  hasEverNotifiedAboutPlaying() check.
- Only consider the main content heuristic as preventing media controls from showing up for the purposes
  of the controls manager. Now Playing should instead account for this by preferring elements large
  enough for main content after collecting all of the candidate sessions.

* html/HTMLMediaElement.cpp:
(WebCore::mediaElementSessionInfoForSession):
(WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession):
(WebCore::HTMLMediaElement::updatePlayState):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::canShowControlsManager):
* platform/audio/mac/MediaSessionManagerMac.mm:
(WebCore::MediaSessionManagerMac::sessionWillBeginPlayback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm