Bug 105224

Summary: Enable autoplay when <video>'s src is from media stream
Product: WebKit Reporter: wjia
Component: MediaAssignee: wjia
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric.carlson, feature-media-reviews, laszlo.gombos, ojan.autocc, tommyw, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description wjia 2012-12-17 15:52:54 PST
The autoplay is disabled on some platform, e.g., Chromium on Android. When <video>'s src is from media stream, autoplay should be allowed to avoid requesting multiple gestures, since user could have gesture for device access permission.
Comment 1 wjia 2012-12-17 15:58:42 PST
Created attachment 179820 [details]
Patch
Comment 2 wjia 2012-12-20 09:50:37 PST
ping.
Comment 3 Adam Barth 2013-01-11 12:13:10 PST
Comment on attachment 179820 [details]
Patch

Can we test this change?
Comment 4 wjia 2013-01-11 14:20:16 PST
In my local build of Chrome on Android, this patch works. Not sure how to add an auto test for this.
Comment 5 Eric Carlson 2013-01-11 14:34:45 PST
(In reply to comment #4)
> In my local build of Chrome on Android, this patch works. Not sure how to add an auto test for this.

Couldn't you use internals.settings.setMediaPlaybackRequiresUserGesture()? See LayoutTests/media/no-autoplay-with-user-gesture-requirement.html for an example.
Comment 6 wjia 2013-01-22 11:48:40 PST
Created attachment 184029 [details]
Patch
Comment 7 wjia 2013-01-22 11:50:12 PST
The test has been added by utilizing platform/chromium/media/video-capture-preview.html in second patch.

Please take another look.
Comment 8 Adam Barth 2013-01-22 14:14:36 PST
Comment on attachment 184029 [details]
Patch

Looks reasonable to me, but I'm not an expert on this code.
Comment 9 Eric Carlson 2013-01-23 14:50:17 PST
Comment on attachment 184029 [details]
Patch

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

> Source/WebCore/html/HTMLMediaElement.cpp:1027
> +#if ENABLE(MEDIA_STREAM)
> +    if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()))
> +        removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction);
> +#endif

Does MediaStreamRegistry::registry().lookupMediaStreamDescriptor() returning true *always* mean that the user has been prompted?
Comment 10 wjia 2013-01-23 15:22:15 PST
(In reply to comment #9)
> (From update of attachment 184029 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=184029&action=review
> 
> > Source/WebCore/html/HTMLMediaElement.cpp:1027
> > +#if ENABLE(MEDIA_STREAM)
> > +    if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()))
> > +        removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction);
> > +#endif
> 
> Does MediaStreamRegistry::registry().lookupMediaStreamDescriptor() returning true *always* mean that the user has been prompted?

Yes. That's described in http://www.w3.org/TR/mediacapture-streams/. More specifically, getUserMedia prompts the user for permission to use their Web cam or other video or audio input.
Comment 11 WebKit Review Bot 2013-01-23 20:01:32 PST
Comment on attachment 184029 [details]
Patch

Rejecting attachment 184029 [details] from commit-queue.

wjia@chromium.org does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 12 WebKit Review Bot 2013-01-23 20:57:32 PST
Comment on attachment 184029 [details]
Patch

Clearing flags on attachment: 184029

Committed r140645: <http://trac.webkit.org/changeset/140645>
Comment 13 WebKit Review Bot 2013-01-23 20:57:36 PST
All reviewed patches have been landed.  Closing bug.