Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)

Created:
4 years, 1 month ago by xjz
Modified:
4 years, 1 month ago
CC:
blink-reviews, blink-reviews-api_chromium.org, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, chromium-reviews, chromoting-reviews_chromium.org, dglazkov+blink, eae+blinkwatch, eric.carlson_apple.com, feature-media-reviews_chromium.org, fs, gasubic, miu+watch_chromium.org, mlamouri+watch-blink_chromium.org, rwlbuis, sof, nessy, Srirama, vcarbune.chromium, xjz+watch_chromium.org, wjmaclean, dcheng
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Monitor the intersection of video and viewport. This CL: 1. Adds ViewportIntersectionObserver to monoitor the intersection of an element with viewport. 2. Consolidates three ElementVisibilityObservers for HTMLMediaElement to one observer. 3. Notifies WebMediaPlayer the intersection info when changed. 4. Adds logic to start remoting when video consistently covers most of the viewport for a certain time. BUG=643964

Patch Set 1 #

Patch Set 2 : Consolidate two ElementVisibilityObserver in AUtoplayUmaHelper. #

Total comments: 24

Patch Set 3 : Observes any video/viewport ratio changes. #

Patch Set 4 : Add ElementViewportRatioObserver. #

Total comments: 22

Patch Set 5 : Addressed miu's comments. #

Total comments: 6

Patch Set 6 : Addressed miu's comments from PS#5. #

Total comments: 14

Patch Set 7 : Addressed comments. Observe intersection changing. #

Total comments: 6

Patch Set 8 : Moved the calculation of intersection ratio to RemotingController. #

Total comments: 10

Patch Set 9 : Addressed comments. #

Total comments: 8

Patch Set 10 : Use empty thresholds to indicate observing intersection with viewport. #

Total comments: 2

Patch Set 11 : Subclass IntersectionObserver. #

Total comments: 2

Patch Set 12 : Rebase. #

Patch Set 13 : Fix trybots failure. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+404 lines, -136 lines) Patch
M media/base/media_observer.h View 1 2 3 4 5 6 7 2 chunks +12 lines, -0 lines 0 comments Download
M media/blink/webmediaplayer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M media/blink/webmediaplayer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -0 lines 0 comments Download
M media/remoting/remoting_renderer_controller.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +14 lines, -0 lines 0 comments Download
M media/remoting/remoting_renderer_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +58 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +51 lines, -11 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +52 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObservation.h View 1 2 3 4 5 6 4 chunks +22 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObservation.cpp View 1 2 3 4 5 6 7 2 chunks +33 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +25 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/dom/IntersectionObserver.cpp View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +30 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/html/AutoplayUmaHelper.h View 1 2 3 4 5 6 5 chunks +10 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp View 1 2 3 4 5 6 9 chunks +24 lines, -45 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.h View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +11 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLMediaElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 9 chunks +29 lines, -28 lines 0 comments Download
M third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -3 lines 0 comments Download
M third_party/WebKit/public/platform/WebMediaPlayer.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +13 lines, -1 line 0 comments Download

Messages

Total messages: 64 (25 generated)
miu
https://codereview.chromium.org/2475643004/diff/40001/media/remoting/remoting_controller.cc File media/remoting/remoting_controller.cc (right): https://codereview.chromium.org/2475643004/diff/40001/media/remoting/remoting_controller.cc#newcode148 media/remoting/remoting_controller.cc:148: is_fullscreen_ = ratio > 0.85; Need "debouncing" logic here. ...
4 years, 1 month ago (2016-11-05 02:47:47 UTC) #3
xjz
miu@: Addressed comments in PS#3. PTAL. https://codereview.chromium.org/2475643004/diff/40001/media/remoting/remoting_controller.cc File media/remoting/remoting_controller.cc (right): https://codereview.chromium.org/2475643004/diff/40001/media/remoting/remoting_controller.cc#newcode148 media/remoting/remoting_controller.cc:148: is_fullscreen_ = ratio ...
4 years, 1 month ago (2016-11-09 02:24:29 UTC) #5
miu
PS4: The media/* files all look good. I have a number of suggestions for the ...
4 years, 1 month ago (2016-11-09 22:02:08 UTC) #7
xjz
Addressed miu's comments. PTAL. ojan@: PTAL blink changes. Thanks! https://codereview.chromium.org/2475643004/diff/120001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h (right): https://codereview.chromium.org/2475643004/diff/120001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h#newcode46 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h:46: ...
4 years, 1 month ago (2016-11-11 01:07:29 UTC) #15
miu
lgtm % some small things: https://codereview.chromium.org/2475643004/diff/140001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h File third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h (right): https://codereview.chromium.org/2475643004/diff/140001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h#newcode23 third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h:23: VisibilityObserverBase(Element*); Add 'explicit' keyword. ...
4 years, 1 month ago (2016-11-11 08:18:33 UTC) #17
xjz
Thanks miu@! Addressed comments in PS#6. +xhwang@ for changes on media/base/* and media/blink/*. Thanks! https://codereview.chromium.org/2475643004/diff/140001/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h ...
4 years, 1 month ago (2016-11-11 17:57:48 UTC) #19
xhwang
Chromium media changes look good. Please get Blink approval first, then I'll take another look. ...
4 years, 1 month ago (2016-11-14 18:32:03 UTC) #20
miu
I had a few new thoughts on this. Some more comments for consideration: https://codereview.chromium.org/2475643004/diff/160001/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp File ...
4 years, 1 month ago (2016-11-14 21:03:33 UTC) #21
mlamouri (slow - plz ping)
I would zqzhang@ to review the media changes.
4 years, 1 month ago (2016-11-14 21:47:41 UTC) #23
Zhiqiang Zhang (Slow)
AutoplayUmaHelper and HTMLMediaElement lgtm % nits I'm a bit worried whether we are observing too ...
4 years, 1 month ago (2016-11-15 11:29:27 UTC) #24
xjz
Thanks zqzhang@ and miu@. Addressed your comments in PS#7. PTAL. +esprehn@ for changes on third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp ...
4 years, 1 month ago (2016-11-15 23:03:40 UTC) #26
miu
Comments on PS7: https://codereview.chromium.org/2475643004/diff/180001/media/blink/webmediaplayer_impl.cc File media/blink/webmediaplayer_impl.cc (right): https://codereview.chromium.org/2475643004/diff/180001/media/blink/webmediaplayer_impl.cc#newcode359 media/blink/webmediaplayer_impl.cc:359: intersect_info.root_rect = I think the types ...
4 years, 1 month ago (2016-11-15 23:29:26 UTC) #27
xjz
Addressed comments. PTAL https://codereview.chromium.org/2475643004/diff/180001/media/blink/webmediaplayer_impl.cc File media/blink/webmediaplayer_impl.cc (right): https://codereview.chromium.org/2475643004/diff/180001/media/blink/webmediaplayer_impl.cc#newcode359 media/blink/webmediaplayer_impl.cc:359: intersect_info.root_rect = On 2016/11/15 23:29:26, miu ...
4 years, 1 month ago (2016-11-16 01:06:45 UTC) #28
miu
PS8 lgtm % small things: https://codereview.chromium.org/2475643004/diff/200001/media/remoting/remoting_controller.h File media/remoting/remoting_controller.h (right): https://codereview.chromium.org/2475643004/diff/200001/media/remoting/remoting_controller.h#newcode119 media/remoting/remoting_controller.h:119: // Video/Viewport ratio meeting/exceeding ...
4 years, 1 month ago (2016-11-16 02:40:26 UTC) #29
xjz
Thanks miu@! Addressed comments in PS #9. https://codereview.chromium.org/2475643004/diff/200001/media/remoting/remoting_controller.h File media/remoting/remoting_controller.h (right): https://codereview.chromium.org/2475643004/diff/200001/media/remoting/remoting_controller.h#newcode119 media/remoting/remoting_controller.h:119: // Video/Viewport ...
4 years, 1 month ago (2016-11-16 07:45:55 UTC) #30
szager1
https://codereview.chromium.org/2475643004/diff/220001/media/remoting/remoting_controller.cc File media/remoting/remoting_controller.cc (right): https://codereview.chromium.org/2475643004/diff/220001/media/remoting/remoting_controller.cc#newcode171 media/remoting/remoting_controller.cc:171: if (ratio < 0.85) { Magic number! Please declare ...
4 years, 1 month ago (2016-11-16 17:53:54 UTC) #32
xjz
Addressed szager@'s comments in PS #10. PTAL. Thanks! https://codereview.chromium.org/2475643004/diff/220001/media/remoting/remoting_controller.cc File media/remoting/remoting_controller.cc (right): https://codereview.chromium.org/2475643004/diff/220001/media/remoting/remoting_controller.cc#newcode171 media/remoting/remoting_controller.cc:171: if ...
4 years, 1 month ago (2016-11-16 20:38:59 UTC) #33
esprehn
Why is this path changing any of the code for intersection observer? How does JS ...
4 years, 1 month ago (2016-11-16 20:47:18 UTC) #34
xjz
On 2016/11/16 20:47:18, esprehn wrote: > Why is this path changing any of the code ...
4 years, 1 month ago (2016-11-16 21:32:12 UTC) #35
szager1
https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp File third_party/WebKit/Source/core/dom/IntersectionObserver.cpp (right): https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp#newcode273 third_party/WebKit/Source/core/dom/IntersectionObserver.cpp:273: if (m_observeViewportIntersection) { Hmm... you're using m_observerViewportIntersection as a ...
4 years, 1 month ago (2016-11-16 21:37:56 UTC) #36
szager1
On 2016/11/16 21:37:56, szager1 wrote: > https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp > File third_party/WebKit/Source/core/dom/IntersectionObserver.cpp (right): > > https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp#newcode273 > ...
4 years, 1 month ago (2016-11-16 21:38:54 UTC) #37
esprehn
Please don't subclass it, that's not something that a JS developer would do either. You ...
4 years, 1 month ago (2016-11-16 22:04:24 UTC) #38
szager1
On 2016/11/16 22:04:24, esprehn wrote: > Please don't subclass it, that's not something that a ...
4 years, 1 month ago (2016-11-16 22:15:12 UTC) #39
esprehn
On 2016/11/16 at 22:15:12, szager wrote: > On 2016/11/16 22:04:24, esprehn wrote: > > Please ...
4 years, 1 month ago (2016-11-16 22:19:21 UTC) #40
miu
On 2016/11/16 22:19:21, esprehn wrote: > On 2016/11/16 at 22:15:12, szager wrote: > > On ...
4 years, 1 month ago (2016-11-16 22:25:07 UTC) #41
szager1
On 2016/11/16 22:19:21, esprehn wrote: > On 2016/11/16 at 22:15:12, szager wrote: > > On ...
4 years, 1 month ago (2016-11-16 22:26:59 UTC) #42
miu
esprehn: I just forwarded you the e-mail discussion that led to this, so you have ...
4 years, 1 month ago (2016-11-16 22:27:37 UTC) #43
xjz
Thanks szager@! Addressed your comments in PS #11. PTAL https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp File third_party/WebKit/Source/core/dom/IntersectionObserver.cpp (right): https://codereview.chromium.org/2475643004/diff/240001/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp#newcode273 third_party/WebKit/Source/core/dom/IntersectionObserver.cpp:273: ...
4 years, 1 month ago (2016-11-16 22:57:15 UTC) #44
Z_DONOTUSE
So sorry for my delay getting back to this. This patch looks great overall. Thanks ...
4 years, 1 month ago (2016-11-17 06:19:06 UTC) #46
xjz
https://codereview.chromium.org/2475643004/diff/260001/media/remoting/remoting_controller.cc File media/remoting/remoting_controller.cc (right): https://codereview.chromium.org/2475643004/diff/260001/media/remoting/remoting_controller.cc#newcode194 media/remoting/remoting_controller.cc:194: is_mostly_filling_viewport_ = true; On 2016/11/17 06:19:05, Z_DONOTUSE wrote: > ...
4 years, 1 month ago (2016-11-17 07:15:18 UTC) #47
xjz
Thanks ojan! I agree with you that we could get intersectionRect/rootRect without modifying the intersectionObserver ...
4 years, 1 month ago (2016-11-17 07:24:35 UTC) #48
esprehn
That sounds like maybe you want to use a ResizeObserver too? Maybe we need an ...
4 years, 1 month ago (2016-11-17 07:38:29 UTC) #51
szager1
On 2016/11/17 07:38:29, esprehn wrote: > That sounds like maybe you want to use a ...
4 years, 1 month ago (2016-11-17 15:43:51 UTC) #54
xjz
On 2016/11/17 15:43:51, szager1 wrote: > On 2016/11/17 07:38:29, esprehn wrote: > > That sounds ...
4 years, 1 month ago (2016-11-17 18:55:42 UTC) #57
ojan
On 2016/11/17 at 18:55:42, xjz wrote: > On 2016/11/17 15:43:51, szager1 wrote: > > On ...
4 years, 1 month ago (2016-11-17 20:21:08 UTC) #58
ojan
On 2016/11/17 at 20:21:08, ojan wrote: > On 2016/11/17 at 18:55:42, xjz wrote: > > ...
4 years, 1 month ago (2016-11-17 20:29:48 UTC) #59
kenrb
On 2016/11/17 06:19:06, Z_DONOTUSE wrote: > 2. In HTMLMediaElement::onVideoViewportIntersectionChanged, do what you're doing > in ...
4 years, 1 month ago (2016-11-17 21:05:23 UTC) #60
miu
On 2016/11/17 20:21:08, ojan wrote: > On 2016/11/17 at 18:55:42, xjz wrote: > > Even ...
4 years, 1 month ago (2016-11-17 21:07:17 UTC) #61
xjz
4 years, 1 month ago (2016-11-18 23:32:00 UTC) #64
On 2016/11/17 21:07:17, miu wrote:
> On 2016/11/17 20:21:08, ojan wrote:
> > On 2016/11/17 at 18:55:42, xjz wrote:
> > > Even this works, we still can't get continuous updates, but just
> per-threshold
> > notification.
> > 
> > Do you need continuous updates? If I'm reading the code right, what you care
> > about is if the video has stayed past the 0.85 viewport threshold for the
last
> 5
> > seconds. So, assuming you know the sizes of the video and the viewport, you
> only
> > need a single threshold and to monitor when it exceeds or doesn't.
> 
> That's not the behavior we want. We're not just interested in an 85%
threshold,
> but also whether the video is still somehow moving/sizing at all. We do not
want
> to activate until the position/size of the video w.r.t. the viewport is
> unchanging for 5 seconds. To be clear, if we are consistently above the 85%
> threshold while the video is still moving/sizing, we do not want to activate.
> That's why we want all updates, not just threshold updates.
> 
> Another concern we have is whether we will want to adjust this logic in the
> future, after UX testing and user feedback. We feel it makes the most sense
for
> the decision-making code to be closer to the control logic for this feature,
> rather than it existing in Blink where others may start to depend on it,
making
> it hard to change in the future.
> 
> That said, if you feel any part of this would be useful for the web platform
as
> a whole, then I agree it would be reasonable to make this available to the web
> platform. The only issue, then, is to formulate a sufficiently generic
solution,
> with all the right "knobs" available for behavior tuning.

Close this issue now as discussed on VC. Opened
https://codereview.chromium.org/2511143006/ for new approach.

Powered by Google App Engine
This is Rietveld 408576698