RESOLVED FIXED 160068
Media controls on apple.com don't disappear when movie finishes playing
https://bugs.webkit.org/show_bug.cgi?id=160068
Summary Media controls on apple.com don't disappear when movie finishes playing
Wenson Hsieh
Reported 2016-07-21 18:48:19 PDT
Media controls on apple.com don't disappear when movie finishes playing
Attachments
Patch (23.31 KB, patch)
2016-07-21 18:55 PDT, Wenson Hsieh
no flags
Patch (26.96 KB, patch)
2016-07-22 16:39 PDT, Wenson Hsieh
no flags
Patch (27.18 KB, patch)
2016-07-22 16:45 PDT, Wenson Hsieh
no flags
Patch (27.15 KB, patch)
2016-07-22 16:51 PDT, Wenson Hsieh
no flags
Patch (26.33 KB, patch)
2016-07-23 00:32 PDT, Wenson Hsieh
no flags
Patch (26.33 KB, patch)
2016-07-23 12:00 PDT, Wenson Hsieh
no flags
Patch for landing (26.37 KB, patch)
2016-07-25 10:20 PDT, Wenson Hsieh
no flags
Patch (15.09 KB, patch)
2016-07-25 12:56 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2016-07-21 18:48:50 PDT
Wenson Hsieh
Comment 2 2016-07-21 18:55:22 PDT
Jeremy Jones
Comment 3 2016-07-22 15:35:31 PDT
Comment on attachment 284297 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284297&action=review Once there is an ended event, from then on these controls are always hidden? That seems like a pretty strong rule. What if the src changes or what if we scrub back from the end and start playing again. Am I missing something or is that really the behavior we want? Is it possible to have a streaming test case also since it has a different code path? > Source/WebCore/html/HTMLMediaElement.cpp:4441 > + m_hasEverSentEndEvent = true; Seems like the streaming case also needs to add the behavior restriction.
Wenson Hsieh
Comment 4 2016-07-22 15:50:29 PDT
The check for m_element.hasEverSentEndEvent() happens right before isElementLargeEnoughForMainContent(m_element). Before we call into this codepath, we've already established the following about the video: - It is not currently ended - The user has not gestured it (e.g. to play/pause) - It is a <video> (with video) Generally, this is enough to say that we should show media controls for it as long as it is large. This patch adds the additional constraint here that it must also not have ended once before, since if it has ended once already and the user has not gestured for it to begin again, we shouldn't be showing controls. It the user has gestured again for the video to play, the check above for !hasBehaviorRestriction(RequireUserGestureToControlControlsManager) || ScriptController::processingUserGestureForMedia() will succeed, and we will show media controls. (In reply to comment #3) > Comment on attachment 284297 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=284297&action=review > > Once there is an ended event, from then on these controls are always hidden? > That seems like a pretty strong rule. What if the src changes or what if we > scrub back from the end and start playing again. Am I missing something or > is that really the behavior we want? > > Is it possible to have a streaming test case also since it has a different > code path? I'll add a test for the streaming case. > > > Source/WebCore/html/HTMLMediaElement.cpp:4441 > > + m_hasEverSentEndEvent = true; > > Seems like the streaming case also needs to add the behavior restriction. Good catch. The restriction should apply here as well.
Wenson Hsieh
Comment 5 2016-07-22 16:39:11 PDT
Jeremy Jones
Comment 6 2016-07-22 16:42:58 PDT
Need to rebase the patch, but it LGTM.
Wenson Hsieh
Comment 7 2016-07-22 16:45:57 PDT
Wenson Hsieh
Comment 8 2016-07-22 16:51:30 PDT
Myles C. Maxfield
Comment 9 2016-07-22 17:19:15 PDT
Comment on attachment 284388 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284388&action=review > Source/WebCore/html/HTMLMediaElement.h:926 > + bool m_isDonePlaying : 1; isDonePlaying is not a very good name, because it doesn't reflect the meaning of this boolean. With the current name, it isn't obvious what the difference between this value and m_playing is. Second, I'm not sure that this variable really belongs here. From discussing the use of this with you over IRC, i'm not sure that HTMLMediaElement is really the class which is concerned with the use case that this variable is describing. Because of separation of concerns, it seems to me that HTMLMediaElement should be concerned with playing / pausing / seeking / etc. the video, and not concerned with keeping track of this state. It seems to me that this state belongs in something which can observe the HTMLMediaElement and make decisions based on what it sees. Maybe I'm wrong, or maybe no such place exists.... either way, I'm not comfortable r+ing this patch. You should ask someone else who knows more about our media infrastructure.
Wenson Hsieh
Comment 10 2016-07-23 00:32:58 PDT
Wenson Hsieh
Comment 11 2016-07-23 12:00:11 PDT
Wenson Hsieh
Comment 12 2016-07-23 12:09:25 PDT
Thinking more about this, I agree -- it's strange for the HTMLMediaElement to keep state around that's only relevant to the media controls heuristic. I believe that state would be better kept on the MediaElementSession in the form of a behavior restriction and have the HTMLMediaElement be able to toggle this switch on or off (which it already does today with RequireUserGestureToControlControlsManager). (In reply to comment #9) > Comment on attachment 284388 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=284388&action=review > > > Source/WebCore/html/HTMLMediaElement.h:926 > > + bool m_isDonePlaying : 1; > > isDonePlaying is not a very good name, because it doesn't reflect the > meaning of this boolean. With the current name, it isn't obvious what the > difference between this value and m_playing is. > > Second, I'm not sure that this variable really belongs here. From discussing > the use of this with you over IRC, i'm not sure that HTMLMediaElement is > really the class which is concerned with the use case that this variable is > describing. Because of separation of concerns, it seems to me that > HTMLMediaElement should be concerned with playing / pausing / seeking / etc. > the video, and not concerned with keeping track of this state. It seems to > me that this state belongs in something which can observe the > HTMLMediaElement and make decisions based on what it sees. > > Maybe I'm wrong, or maybe no such place exists.... either way, I'm not > comfortable r+ing this patch. You should ask someone else who knows more > about our media infrastructure.
Wenson Hsieh
Comment 13 2016-07-25 10:20:43 PDT
Created attachment 284497 [details] Patch for landing
WebKit Commit Bot
Comment 14 2016-07-25 10:50:22 PDT
Comment on attachment 284497 [details] Patch for landing Clearing flags on attachment: 284497 Committed r203690: <http://trac.webkit.org/changeset/203690>
WebKit Commit Bot
Comment 15 2016-07-25 10:50:28 PDT
All reviewed patches have been landed. Closing bug.
Wenson Hsieh
Comment 16 2016-07-25 12:56:28 PDT
Reopening to attach new patch.
Wenson Hsieh
Comment 17 2016-07-25 12:56:29 PDT
Wenson Hsieh
Comment 18 2016-07-25 12:58:56 PDT
Accidentally reopened due to uploading a patch for the wrong bug. Please ignore!
Note You need to log in before you can comment on or make changes to this bug.