|
|
Chromium Code Reviews|
Created:
4 years, 6 months ago by whywhat Modified:
4 years, 6 months ago CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, eric.carlson_apple.com, feature-media-reviews_chromium.org, fs, gasubic, mlamouri+watch-blink_chromium.org, nessy, vcarbune.chromium Base URL:
https://chromium.googlesource.com/chromium/src.git@autoplay-flag Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionPause autoplay muted video when unmuting if there's no user gesture
BUG=617598
TEST=https://avayvod.github.io/autoplay-test.html
Committed: https://crrev.com/73df13de2a2ba7d1d7e132a3934d4d39f1959b66
Cr-Commit-Position: refs/heads/master@{#399174}
Patch Set 1 #Patch Set 2 : Added layout test for pausing when unmute #Patch Set 3 : Added a test case for unmuting with gesture #Patch Set 4 : Fixed accidental ws change #
Total comments: 1
Patch Set 5 : Check isGestureNeeded when unmuting #
Total comments: 3
Patch Set 6 : Addressed comments #
Dependent Patchsets: Messages
Total messages: 34 (10 generated)
avayvod@chromium.org changed reviewers: + mlamouri@chromium.org
PTaL I feel like having isGestureNeeded... method un-const-ed and have a side effect is not ideal but so far it was the best I could think of to avoid refactoring the places it's called from and duplicating code.
The CQ bit was checked by avayvod@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2047333002/1
Added layout test for pausing when unmute
The CQ bit was checked by avayvod@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2047333002/20001
Added a test case for unmuting with gesture
The CQ bit was checked by avayvod@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2047333002/40001
Fixed accidental ws change
What about having:
enum GestureRequirement {
None,
NoneBecauseMuted,
Yes
}
GestureRequirement getGestureRequirement() const;
then code will do:
if (getGestureRequirement() != GestureRequirement::Yes) {
if (getGestureRequirement() == GestureRequirement::NoneBecauseMuted) {
m_autoplayingBecauseMUted = true;
}
}
How silly does that sound?
+foolip@ in case he has opinions.
foolip@chromium.org changed reviewers: + foolip@chromium.org
https://codereview.chromium.org/2047333002/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/2047333002/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:2282: if (!muted && m_isAutoplayingMuted) { As per https://github.com/whatwg/html/issues/976 I don't think should depend on whether the reason that we're playing, but rather that when setting muted to false and it was previously true and there is no user gesture, the internal pause steps should be run. That's easy to explain and avoids that extra state bit.
I'm really worried this would break way too many websites. Actually, I wonder if we could avoid the extra state by simply checking if the element is unlocked? In ::setMuted(), we could change the mute state then run isUserGestureRequired(). If a user gesture is required, we pause the playback. WDYT?
On 2016/06/09 at 13:17:13, mlamouri wrote: > I'm really worried this would break way too many websites. > > Actually, I wonder if we could avoid the extra state by simply checking if the element is unlocked? > > In ::setMuted(), we could change the mute state then run isUserGestureRequired(). If a user gesture is required, we pause the playback. > > WDYT? It sounds like you and Philip suggest the same using slightly different wording?
On 2016/06/09 at 13:51:01, avayvod wrote: > On 2016/06/09 at 13:17:13, mlamouri wrote: > > I'm really worried this would break way too many websites. > > > > Actually, I wonder if we could avoid the extra state by simply checking if the element is unlocked? > > > > In ::setMuted(), we could change the mute state then run isUserGestureRequired(). If a user gesture is required, we pause the playback. > > > > WDYT? > > It sounds like you and Philip suggest the same using slightly different wording? Hmm, maybe I misunderstood Philip. What I assumed is that we would always require a user gesture to unmute while what I mean is that we should only require a gesture if non was ever provided. Maybe that was obvious for you two and not for me :(
Check isGestureNeeded when unmuting
PTAL
The CQ bit was checked by avayvod@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2047333002/80001
On 2016/06/09 14:19:59, Mounir Lamouri (slow) wrote: > On 2016/06/09 at 13:51:01, avayvod wrote: > > On 2016/06/09 at 13:17:13, mlamouri wrote: > > > I'm really worried this would break way too many websites. > > > > > > Actually, I wonder if we could avoid the extra state by simply checking if > the element is unlocked? > > > > > > In ::setMuted(), we could change the mute state then run > isUserGestureRequired(). If a user gesture is required, we pause the playback. > > > > > > WDYT? > > > > It sounds like you and Philip suggest the same using slightly different > wording? > > Hmm, maybe I misunderstood Philip. What I assumed is that we would always > require a user gesture to unmute while what I mean is that we should only > require a gesture if non was ever provided. Maybe that was obvious for you two > and not for me :( No, I really did mean always requiring a user gesture, otherwise we also have to standardize where "requires user gesture" bit is stored. In Blink it's on individual media elements, but WebKit has already switched to another system. I asked about this in https://github.com/whatwg/html/issues/976#issuecomment-223232285 to shake out any assumptions around this, but communication is hard :) I suggest that we discuss this in the coming spec PR so that we can also get Jer to comment.
On 2016/06/09 15:10:46, Philip Jägenstedt wrote: > On 2016/06/09 14:19:59, Mounir Lamouri (slow) wrote: > > On 2016/06/09 at 13:51:01, avayvod wrote: > > > On 2016/06/09 at 13:17:13, mlamouri wrote: > > > > I'm really worried this would break way too many websites. > > > > > > > > Actually, I wonder if we could avoid the extra state by simply checking if > > the element is unlocked? > > > > > > > > In ::setMuted(), we could change the mute state then run > > isUserGestureRequired(). If a user gesture is required, we pause the playback. > > > > > > > > WDYT? > > > > > > It sounds like you and Philip suggest the same using slightly different > > wording? > > > > Hmm, maybe I misunderstood Philip. What I assumed is that we would always > > require a user gesture to unmute while what I mean is that we should only > > require a gesture if non was ever provided. Maybe that was obvious for you two > > and not for me :( > > No, I really did mean always requiring a user gesture, otherwise we also have to > standardize where "requires user gesture" bit is stored. In Blink it's on > individual media elements, but WebKit has already switched to another system. > > I asked about this in > https://github.com/whatwg/html/issues/976#issuecomment-223232285 to shake out > any assumptions around this, but communication is hard :) > > I suggest that we discuss this in the coming spec PR so that we can also get Jer > to comment. So, I can also see the simplicity of using the exact same rules as for calls to play(), having different rules isn't easy to explain either. It is at least a theoretical problem that Chrome and Safari use different bits of state here, but perhaps a better approach to that problem would be to follow Safari and try to standardize if it seems like no variation is useful.
On 2016/06/09 at 15:31:32, foolip wrote: > On 2016/06/09 15:10:46, Philip Jägenstedt wrote: > > On 2016/06/09 14:19:59, Mounir Lamouri (slow) wrote: > > > On 2016/06/09 at 13:51:01, avayvod wrote: > > > > On 2016/06/09 at 13:17:13, mlamouri wrote: > > > > > I'm really worried this would break way too many websites. > > > > > > > > > > Actually, I wonder if we could avoid the extra state by simply checking if > > > the element is unlocked? > > > > > > > > > > In ::setMuted(), we could change the mute state then run > > > isUserGestureRequired(). If a user gesture is required, we pause the playback. > > > > > > > > > > WDYT? > > > > > > > > It sounds like you and Philip suggest the same using slightly different > > > wording? > > > > > > Hmm, maybe I misunderstood Philip. What I assumed is that we would always > > > require a user gesture to unmute while what I mean is that we should only > > > require a gesture if non was ever provided. Maybe that was obvious for you two > > > and not for me :( > > > > No, I really did mean always requiring a user gesture, otherwise we also have to > > standardize where "requires user gesture" bit is stored. In Blink it's on > > individual media elements, but WebKit has already switched to another system. > > > > I asked about this in > > https://github.com/whatwg/html/issues/976#issuecomment-223232285 to shake out > > any assumptions around this, but communication is hard :) > > > > I suggest that we discuss this in the coming spec PR so that we can also get Jer > > to comment. > > So, I can also see the simplicity of using the exact same rules as for calls to play(), having different rules isn't easy to explain either. > > It is at least a theoretical problem that Chrome and Safari use different bits of state here, but perhaps a better approach to that problem would be to follow Safari and try to standardize if it seems like no variation is useful. It seems like we would use the same rules as play for unmuting either way. Changing the rule would change isGestureRequiredForPlayback() method but not the logic introduced in setMuted(). I'll start the PR then.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm with comments applied. https://codereview.chromium.org/2047333002/diff/80001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/media/autoplay-muted.html (right): https://codereview.chromium.org/2047333002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/media/autoplay-muted.html:37: { style: { at end of previous line (here and other places in this file) https://codereview.chromium.org/2047333002/diff/80001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/media/autoplay-muted.html:64: document.onclick = t.step_func_done(function() can you move this outside of the play() handler? just simulate the click in the play handler. https://codereview.chromium.org/2047333002/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/html/HTMLMediaElement.cpp (right): https://codereview.chromium.org/2047333002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/html/HTMLMediaElement.cpp:2281: // Pause the element when unmuting if there was no user gesture. nit: s/if there was no user gesture./if the element is still locked./
Addressed comments
The CQ bit was checked by avayvod@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from mlamouri@chromium.org Link to the patchset: https://codereview.chromium.org/2047333002/#ps100001 (title: "Addressed comments")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2047333002/100001
Message was sent while issue was closed.
Committed patchset #6 (id:100001)
Message was sent while issue was closed.
Description was changed from ========== Pause autoplay muted video when unmuting if there's no user gesture BUG=617598 TEST=https://avayvod.github.io/autoplay-test.html ========== to ========== Pause autoplay muted video when unmuting if there's no user gesture BUG=617598 TEST=https://avayvod.github.io/autoplay-test.html Committed: https://crrev.com/73df13de2a2ba7d1d7e132a3934d4d39f1959b66 Cr-Commit-Position: refs/heads/master@{#399174} ==========
Message was sent while issue was closed.
Patchset 6 (id:??) landed as https://crrev.com/73df13de2a2ba7d1d7e132a3934d4d39f1959b66 Cr-Commit-Position: refs/heads/master@{#399174} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
