Bug 156089 - Add some logic to decide when a video can control the videoControlsManager
Summary: Add some logic to decide when a video can control the videoControlsManager
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-31 16:14 PDT by Beth Dakin
Modified: 2016-04-04 14:21 PDT (History)
4 users (show)

See Also:


Attachments
Patch (20.60 KB, patch)
2016-03-31 17:12 PDT, Beth Dakin
no flags Details | Formatted Diff | Diff
Patch (20.75 KB, patch)
2016-04-01 11:16 PDT, Beth Dakin
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Beth Dakin 2016-03-31 16:14:57 PDT
Add some logic to decide when a video can control the videoControlsManager

rdar://problem/23833752
Comment 1 Beth Dakin 2016-03-31 17:12:26 PDT
Created attachment 275360 [details]
Patch
Comment 2 Beth Dakin 2016-04-01 11:16:56 PDT
Created attachment 275421 [details]
Patch
Comment 3 Eric Carlson 2016-04-01 13:07:59 PDT
Comment on attachment 275421 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=275421&action=review

This looks good to me modulo the minor nits noted, but I am not a WK2 reviewer so someone else will have to give the official nod.

> Source/WebCore/html/HTMLMediaElement.cpp:4847
> +        if (endedPlayback() && document().page() && is<HTMLVideoElement>(*this))

As we discussed, this will cause issues when a video's src is changed in the 'ended' event to make a playlist. Probably worth filing a bug to investigate this.

> Source/WebCore/html/MediaElementSession.cpp:219
> +    // FIXME: Audio elements should be able to have a controls manager as well. Audio elements
> +    // should probably only have a controls manager if they started playing via a user gesture.

It would be good to have a bug number here.

> Source/WebCore/html/MediaElementSession.cpp:233
> +    if (renderer->clientWidth() >= elementMainContentMinimumWidth && renderer->clientHeight() >= elementMainContentMinimumHeight) {
> +        if (element.hasAudio() && element.hasVideo())
> +            return true;
> +    }

Do you care if the <video> is visible in the page or not?
Comment 4 Beth Dakin 2016-04-04 14:21:59 PDT
Thanks Eric and Tim!

(In reply to comment #3)
> Comment on attachment 275421 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=275421&action=review
> 
> This looks good to me modulo the minor nits noted, but I am not a WK2
> reviewer so someone else will have to give the official nod.
> 
> > Source/WebCore/html/HTMLMediaElement.cpp:4847
> > +        if (endedPlayback() && document().page() && is<HTMLVideoElement>(*this))
> 
> As we discussed, this will cause issues when a video's src is changed in the
> 'ended' event to make a playlist. Probably worth filing a bug to investigate
> this.
> 

YouTube playlists do seem to work. Can you think of another playlist that might fail? I do want to file a bug, but I would like to have an example.

> > Source/WebCore/html/MediaElementSession.cpp:219
> > +    // FIXME: Audio elements should be able to have a controls manager as well. Audio elements
> > +    // should probably only have a controls manager if they started playing via a user gesture.
> 
> It would be good to have a bug number here.
> 

Added one: rdar://problem/25537071

> > Source/WebCore/html/MediaElementSession.cpp:233
> > +    if (renderer->clientWidth() >= elementMainContentMinimumWidth && renderer->clientHeight() >= elementMainContentMinimumHeight) {
> > +        if (element.hasAudio() && element.hasVideo())
> > +            return true;
> > +    }
> 
> Do you care if the <video> is visible in the page or not?

I think I might…still thinking this over actually. I can imagine kind of see it either way. If the video is still playing and the audio is still happening, it seems like it shouldn't matter that it has been scroll offscreen? But if the video stopped because it was scrolled away, then then we do care. We'll have to think this through.

Thank you!

http://trac.webkit.org/changeset/199022