Bug 169140 - WKWebView should provide a way for clients to know the specific media state.
Summary: WKWebView should provide a way for clients to know the specific media state.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-03-03 12:15 PST by Andrew Gold
Modified: 2017-03-09 15:58 PST (History)
7 users (show)

See Also:


Attachments
Proposed patch. (16.46 KB, patch)
2017-03-06 18:29 PST, Andrew Gold
no flags Details | Formatted Diff | Diff
proposed patch v2. (22.86 KB, patch)
2017-03-07 13:43 PST, Andrew Gold
no flags Details | Formatted Diff | Diff
Proposed patch v3. (16.51 KB, patch)
2017-03-07 13:51 PST, Andrew Gold
no flags Details | Formatted Diff | Diff
Proposed patch v4. (13.56 KB, patch)
2017-03-07 15:21 PST, Andrew Gold
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Gold 2017-03-03 12:15:01 PST
Currently, WKUIDelegate methods are called when a WKWebView begins/ends a capture session. Now, clients must know which specific devices are being used (microphone, camera, or both).
Comment 1 Jon Lee 2017-03-03 15:20:01 PST
<rdar://problem/30838285>
Comment 2 Andrew Gold 2017-03-06 18:29:54 PST
Created attachment 303598 [details]
Proposed patch.
Comment 3 WebKit Commit Bot 2017-03-06 18:31:06 PST
Attachment 303598 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:42:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Jon Lee 2017-03-06 19:12:29 PST
Comment on attachment 303598 [details]
Proposed patch.

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

> Source/WebKit2/ChangeLog:3
> +        WKWebView should provide a way for client's to know the specific media state.

No apostrophe.

> Source/WebKit2/ChangeLog:4
> +        https://bugs.webkit.org/show_bug.cgi?id=169140

Please include the Radar number.

> Source/WebKit2/UIProcess/WebPageProxy.cpp:6455
> +    if ((oldState & activeCaptureMask) != (m_mediaState & activeCaptureMask))

Isn't this just `if (oldMediaStateHasActiveCapture != newMediaStateHasActiveCapture)`?
Comment 5 Andrew Gold 2017-03-07 08:51:47 PST
(In reply to comment #4)
> Comment on attachment 303598 [details]
> Proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=303598&action=review
> 
> > Source/WebKit2/ChangeLog:3
> > +        WKWebView should provide a way for client's to know the specific media state.
> 
> No apostrophe.

Oops.

> 
> > Source/WebKit2/ChangeLog:4
> > +        https://bugs.webkit.org/show_bug.cgi?id=169140
> 
> Please include the Radar number.

Done.

> 
> > Source/WebKit2/UIProcess/WebPageProxy.cpp:6455
> > +    if ((oldState & activeCaptureMask) != (m_mediaState & activeCaptureMask))
> 
> Isn't this just `if (oldMediaStateHasActiveCapture !=
> newMediaStateHasActiveCapture)`?

No, because the MediaState may change for reasons other than a capture session beginning or ending (such as when audio/video starts playing).
Comment 6 Andrew Gold 2017-03-07 13:43:12 PST
Created attachment 303717 [details]
proposed patch v2.
Comment 7 Andrew Gold 2017-03-07 13:48:26 PST
(In reply to comment #6)
> Created attachment 303717 [details]
> proposed patch v2.

Ignore this. Wrong patch.
Comment 8 Andrew Gold 2017-03-07 13:51:41 PST
Created attachment 303720 [details]
Proposed patch v3.
Comment 9 WebKit Commit Bot 2017-03-07 13:53:31 PST
Attachment 303720 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:42:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Andrew Gold 2017-03-07 13:57:15 PST
Bug for tests: https://bugs.webkit.org/show_bug.cgi?id=169304
Comment 11 Andrew Gold 2017-03-07 14:48:18 PST
(In reply to comment #5)
> (In reply to comment #4)
> > Comment on attachment 303598 [details]
> > Proposed patch.
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=303598&action=review
> > 
> > > Source/WebKit2/ChangeLog:3
> > > +        WKWebView should provide a way for client's to know the specific media state.
> > 
> > No apostrophe.
> 
> Oops.
> 
> > 
> > > Source/WebKit2/ChangeLog:4
> > > +        https://bugs.webkit.org/show_bug.cgi?id=169140
> > 
> > Please include the Radar number.
> 
> Done.
> 
> > 
> > > Source/WebKit2/UIProcess/WebPageProxy.cpp:6455
> > > +    if ((oldState & activeCaptureMask) != (m_mediaState & activeCaptureMask))
> > 
> > Isn't this just `if (oldMediaStateHasActiveCapture !=
> > newMediaStateHasActiveCapture)`?
> 
> No, because the MediaState may change for reasons other than a capture
> session beginning or ending (such as when audio/video starts playing).

I'm sorry, I misread this comment. You're right, that is the same. Will make this change, along with some others Alex and I discussed offline.
Comment 12 Andrew Gold 2017-03-07 15:21:01 PST
Created attachment 303735 [details]
Proposed patch v4.
Comment 13 WebKit Commit Bot 2017-03-07 15:23:33 PST
Attachment 303735 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h:42:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Jon Lee 2017-03-07 20:28:30 PST
Comment on attachment 303735 [details]
Proposed patch v4.

r=me. WK2 review needed.
Comment 15 WebKit Commit Bot 2017-03-09 15:58:05 PST
Comment on attachment 303735 [details]
Proposed patch v4.

Clearing flags on attachment: 303735

Committed r213683: <http://trac.webkit.org/changeset/213683>
Comment 16 WebKit Commit Bot 2017-03-09 15:58:11 PST
All reviewed patches have been landed.  Closing bug.