Currently getUserMedia returns error names that do not match the spec.
For example, ConstraintNotSatisfiedError should be 'OverconstrainedError'.
And there are many other examples.
code is here:
https://codesearch.chromium.org/chromium/src/content/renderer/media/user_media_client_impl.cc?q=MediaDeviceNotSupported+package:%5Echromium$&l=1030
PermissionDismissedError => filed https://github.com/w3c/mediacapture-main/issues/451
InvalidStateError => NotReadableError
DevicesNotFoundError => NotFoundError
ConstraintNotSatisfiedError => OverConstrainedError
TrackStartError => NotReadableError
MediaDeviceNotSupported => ? (there used to be a NotSupportedError)
MediaDeviceFailedDueToShutdown => NotReadableError
MediaDeviceKillSwitchOn => NotReadableError
Some of the errors have more detail than NotReadableError. I don't really like losing that information but afaics in my metrics those are quite rare, e.g. MediaDeviceFailedDueToShutdown has an error rate of approximately 1/250.000
another thing to keep in mind: it might be possible to implement legacy constraints as "user has not updated", returning the legacy error. This would provide a more gentle transition (for lazy folks).
hrm... related, how about this one:
navigator.mediaDevices.getUserMedia({})
.then(console.log, console.error)
From https://w3c.github.io/mediacapture-main/ this should reject the promise:
If requestedMediaTypes is the empty set, return a promise rejected with a
TypeError.
but it seems to throw and return a resolved promise.
guido: yes, #14 looks fixed.
orphis: basically its a "hi, I broke non-spec behaviour you relied on. You are hereby given notice that you have some weeks until this lands in stable. If you don't fix your code before that its your own responsiblity not mine" :-)
In this particular case it might be useful for people to use the error code mapping from https://github.com/webrtc/adapter/blob/master/src/js/chrome/getusermedia.js#L135-L152 so they can look for spec-errors even in chrome stable.
The way to check is to invoke getUserMedia on a variety of scenarios.
Examples:
-On a machine without any devices (should produce NotFoundError)
-Have the webcam locked by an application other than Chrome (should produce NotReadableError)
-Deny/dismiss permissions (should produce NotAllowedError)
invoking getUserMedia with constraints that cannot be satisfied. For example, getUserMedia({video: {width: {exact: 100000}}}) (should produce OverconstrainedError)
Comment 1 by philipp....@googlemail.com
, May 12 2017