Bug 158393

Summary: getUserMedia() exposed, but not functional
Product: WebKit Reporter: Niels Leenheer (HTML5test) <info>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Major CC: ap, commit-queue, daniele.tassone, eric.carlson, nekr.fabula, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: All   
Attachments:
Description Flags
Proposed patch.
dino: review+
Patch for landing. none

Description Niels Leenheer (HTML5test) 2016-06-04 23:47:24 PDT
The getUserMedia() function is exposed, but when you try to use it, it just fails and calls the error callback. This breaks feature detection. 


navigator.getUserMedia({ video: true, audio: true }, function() { console.log('success', arguments) }, function() { console.log('error', arguments) })

=> error – Arguments [ Error: NotAllowedError: DOM Exception 35 ]


and:


!!navigator.getUserMedia

=> true


This is also a problem for HTML5test.com where Safari currently gets points for supporting getUserMedia, without actually deserving so. I hope this is an unfinished implementation that will be ready for the next release of Safari, but if not, it should not be exposed publicly. Otherwise I'm afraid I have to put this feature on a blacklist so that HTML5test.com won't show an inaccurate result.

The same thing applies to the prefixed webkitGetUserMedia function.
Comment 1 Eric Carlson 2016-06-05 10:42:49 PDT
(In reply to comment #0)
> 
> This is also a problem for HTML5test.com where Safari currently gets points
> for supporting getUserMedia, without actually deserving so. I hope this is
> an unfinished implementation that will be ready for the next release of
> Safari, but if not, it should not be exposed publicly. Otherwise I'm afraid
> I have to put this feature on a blacklist so that HTML5test.com won't show
> an inaccurate result.
> 
> The same thing applies to the prefixed webkitGetUserMedia function.

Are you testing with a WebKit nightly build, or with Safari Technology Preview?
Comment 2 Niels Leenheer (HTML5test) 2016-06-05 11:04:31 PDT
Safari Technical Preview 5 (this issue has been present since Preview 1)
Comment 3 Niels Leenheer (HTML5test) 2016-06-05 11:08:55 PDT
Bug is also visible in WebKit Nightly r201698.
Comment 4 Radar WebKit Bug Importer 2016-06-05 11:16:44 PDT
<rdar://problem/26642259>
Comment 5 Eric Carlson 2016-06-30 12:38:56 PDT
Created attachment 282457 [details]
Proposed patch.
Comment 6 WebKit Commit Bot 2016-06-30 12:40:53 PDT
Attachment 282457 [details] did not pass style-queue:


ERROR: Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:41:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:43:  preprocessor directives (e.g., #ifdef, #define, #import) should never be indented.  [whitespace/indent] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Dean Jackson 2016-06-30 12:57:23 PDT
Comment on attachment 282457 [details]
Proposed patch.

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

> Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:72
>  #if ENABLE(MEDIA_STREAM)

Maybe this should be #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA) ?
Comment 8 Dean Jackson 2016-06-30 12:57:57 PDT
Comment on attachment 282457 [details]
Proposed patch.

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

>> Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:72
>>  #if ENABLE(MEDIA_STREAM)
> 
> Maybe this should be #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA) ?

Oops. I meant !PLATFORM(COCOA) :)
Comment 9 Eric Carlson 2016-06-30 13:39:14 PDT
Created attachment 282460 [details]
Patch for landing.
Comment 10 WebKit Commit Bot 2016-06-30 14:20:52 PDT
Comment on attachment 282460 [details]
Patch for landing.

Clearing flags on attachment: 282460

Committed r202704: <http://trac.webkit.org/changeset/202704>
Comment 11 Niels Leenheer (HTML5test) 2016-07-21 14:50:38 PDT
navigator.getUserMedia is no longer exposed in Safari Technology Preview 9.

Not originally mentioned in this bug, but the new API for getUserMedia was also exposed in earlier versions. The patch that has landed did not fix that. In fact, navigator.mediaDevices.getUserMedia is still exposed in the latest Technology 
Preview.


navigator.mediaDevices.getUserMedia({ audio: true, video: true }).catch(function(e) { console.log(e) });

=> Error: NotAllowedError: DOM Exception 35
Comment 12 Alexey Proskuryakov 2019-09-24 17:30:42 PDT
> Committed r202704: <http://trac.webkit.org/changeset/202704>

Moving to RESOLVED since this landed.