This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22251 - Define better error when no video or audio source is available
Summary: Define better error when no video or audio source is available
Status: RESOLVED FIXED
Alias: None
Product: WebRTC Working Group
Classification: Unclassified
Component: Media Capture and Streams (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Harald Alvestrand
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 25988
Blocks: 22217
  Show dependency treegraph
 
Reported: 2013-06-03 16:30 UTC by Dominique Hazael-Massieux
Modified: 2014-08-25 07:40 UTC (History)
6 users (show)

See Also:


Attachments

Description Dominique Hazael-Massieux 2013-06-03 16:30:33 UTC
If the device has no way to stream live video, the current algorithm sets finalSet to an empty set, asks the user agent to prompt the user on that set.

Thus it's not clear whether:
* the UA should prompt at all (I guess it could offer to stream a video file in that case)
* whether it ends with "permission denied", or a stalled algorithm

It would seem maybe more logical to trigger a ContraintNotSatisfied error, although it's not clear what the name of the constraint should be in that case (maybe the name of the requested media type?).

(handling the absence of a media device differently is odd, since one could always get the same thing via a trivial mandatory constraint, e.g. video : { mandatory : {width: { min:0}}} )
Comment 1 Stefan Hakansson LK 2013-06-05 12:38:04 UTC
To me it makes sense to trigger a ConstraintNotSatisfied error with the name of the media type that could not be supplied as name.

I guess that if both audio and video is requested (audio: true and video: true), but none can be delivered, it does not really matter if audio or video is reported as constraintName.
Comment 2 Paul Neave 2013-06-05 13:16:29 UTC
I believe Firefox have implemented a non-standard NO_DEVICES_FOUND error for the case when no device for audio/video is available. I prefer this approach as I think a separate error would be better than conflating with the CONSTRAINT_NOT_SATISFIED error, which should only be for cases when a specific mandatory constraint cannot be met.

Firefox also uses a non-standard HARDWARE_UNAVAILABLE error for when a device exists but for some reason cannot be used (such as, it is already in use by another web page/program).

Thoughts?
Comment 3 Paul Neave 2013-08-02 09:10:44 UTC
I recently made a proposal for two new NavigatorUserMediaError error codes on the mailing list: http://lists.w3.org/Archives/Public/public-media-capture/2013Jul/0124.html

They are:

HARDWARE_UNAVAILABLE - A suitable device is connected but a hardware error prevented access (such as an OS/program/webpage lock)

and

NO_DEVICES_FOUND - No suitable devices are connected whatsoever

This matches Firefox's current implementation, and I would like to see them formerly adopted into the spec.

Also, perhaps all NavigatorUserMediaError error codes should use camelCase instead and inherit from DOMError, as ticket 22216 has requested: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22216
Comment 4 Adam Bergkvist 2013-08-14 08:09:41 UTC
(In reply to comment #3)
> Also, perhaps all NavigatorUserMediaError error codes should use camelCase
> instead and inherit from DOMError, as ticket 22216 has requested:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=22216

This is fixed and will be in the next release.
Comment 5 Harald Alvestrand 2013-08-21 11:34:14 UTC
Suggested resolution, now that we inherit from DOMError:

NO_DEVICES_FOUND -> NotFoundError (existing DOMError code)
HARDWARE_UNAVAILABLE -> AbortError (existing DOMError code)
                     -> SourceUnavailable (NEW DOMError code)
Comment 6 Paul Neave 2013-08-21 11:37:41 UTC
(In reply to comment #5)
> Suggested resolution, now that we inherit from DOMError:
> 
> NO_DEVICES_FOUND -> NotFoundError (existing DOMError code)
> HARDWARE_UNAVAILABLE -> AbortError (existing DOMError code)
>                      -> SourceUnavailable (NEW DOMError code)

This seems very sensible. Thanks Harald.
Comment 7 Anne 2013-08-21 13:47:04 UTC
FWIW, we're getting rid of DOMError: http://dom.spec.whatwg.org/#domerror
Comment 8 Harald Alvestrand 2013-08-21 14:21:37 UTC
At the moment the comment says:

"DOMError might be nuked in favor of using DOMException exclusively. See Creating your own errors on es-discuss for more details."

DOMException seems to be numeric codes named with ALL_CAPS_WITH_UNDERSCORES.

Are you going back to that naming style again?

"There are two ways to do this. The deprecated one, and the one that doesn't work yet."
Comment 9 Anne 2013-08-21 14:43:54 UTC
DOMException has a name field that returns the new-style name. However, we're still discussing with TC39 what the best way of error handling throughout the platform would be. (The editor of JavaScript actually favors a fairly minimalistic approach, without much branching on different types of exceptions and without introducing new ones.)
Comment 10 Harald Alvestrand 2014-03-21 15:00:20 UTC
Now that we don't inherit from DOMError any more, since that's going away, but we still have an error object with a name and a message:

Suggested change of names:

NO_DEVICES_FOUND -> NotFoundError (existing DOMError name)
HARDWARE_UNAVAILABLE -> AbortError (existing DOMError name)
                     -> SourceUnavailable (NEW name)


I'll create a new tracking error for the whole DOMError -> JS Error issue.
Comment 11 Stefan Hakansson LK 2014-08-25 07:40:22 UTC
FIxed in version http://dev.w3.org/2011/webrtc/editor/archives/20140817/getusermedia.html