W3C home > Mailing lists > Public > public-webrtc@w3.org > May 2012

Re: getUserMedia and disconnecting devices

From: Alexey Aylarov <alexey@zingaya.com>
Date: Mon, 14 May 2012 08:50:50 +0400
To: Marcin Simonides <msimonides@opera.com>, <public-webrtc@w3.org>
Message-ID: <CBD67591.15FE6%alexey@zingaya.com>
Hello,

I think it's better to make it as flexible for developers as possible.

PERMISSION_DENIED has to be presented to let developers handle this event
and it's a good idea to let them re-ask the access again if user denied it
accidentally. Probably it's already implemented in this way.

NOT_SUPPORTED_ERR sounds like reasonable event for the case when there are
no audio/video recording devices at all.


DEVICE_NOT_AVAILABLE could be a good event for the case when device is
presented, but by some reason is unavailable while access request.


BR,
Alexey Aylarov

5/11/12 7:38 PM пользователь "Marcin Simonides" <msimonides@opera.com>
написал:

>Hello,
>
>I wish to clarify how errors should be reported by getUserMedia in case
>no devices are available or when a device is disconnected.
>
>Let's assume there is a PC with USB camera that may be attached and
>detached and
>
>   getUserMedia({ video: true }, success_callback, error_callback)
>
>is called. (an analogous situation could arise with the use of other
>devices like a Bluetooth headphone)
>
>Case 1: no camera attached.
>When there's no camera at all there are two possibilities: throw a
>NOT_SUPPORTED_ERR exception or call error_callback with the only
>available error code: PERMISSION_DENIED.
>
>NOT_SUPPORTED_ERR sounds like a more appropriate error than
>PERMISSION_DENIED when there is no device but step 9 of the algorithm[1]
>says "...due to platform limitations, jump to the step labeled failure
>below."
>The "failure" step says that the error_callback should be called.
>
>Case 2: camera attached when calling getUserMedia but detached before
>the user has granted permission for its use.
>
>In this case a sensible way to handle the error is to abort the UI for
>asking user consent and call the error_callback. Again, the only
>possible error code is PERMISSION_DENIED.
>
>Case 3: camera is attached and the user grants permission for its use,
>success_callback is called with a LocalMediaStream object and then the
>camera is detached.
>
>In this case the LocalMediaStream should be stopped when the camera is
>disconnected and an ended event should be dispatched.
>
>
>In cases 1 and 2 the best approach seems to be calling the
>error_callback with PERMISSION_DENIED but this code doesn't sound
>appropriate.
>Therefore I suggest to introduce a new error code, e.g.
>DEVICE_NOT_AVAILABLE.
>
>
>Alternatively, since distinguishing between PERMISSION_DENIED and
>DEVICE_NOT_AVAILABLE is of little value to the web developer (other than
>maybe displaying an appropriate error message), the PERMISSION_DENIED
>error code could be renamed DEVICE_NOT_AVAILABLE or something else that
>is general enough to cover both cases.
>-- 
>Marcin Simonides
>
>[1] http://dev.w3.org/2011/webrtc/editor/getusermedia.html#local-content
>-- 
>Marcin Simonides
>
>
Received on Monday, 14 May 2012 05:39:36 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:28 UTC