W3C home > Mailing lists > Public > public-media-capture@w3.org > February 2015

Re: Input needed: Cancelling a permission request?

From: Martin Thomson <martin.thomson@gmail.com>
Date: Fri, 27 Feb 2015 10:18:21 +1300
Message-ID: <CABkgnnWQqGfSpWp-UmHjUO7rZfO2zin6SgN8+nkkdz_7kf4MUg@mail.gmail.com>
To: Stefan HÃ¥kansson LK <stefan.lk.hakansson@ericsson.com>
Cc: Anne van Kesteren <annevk@annevk.nl>, Harald Alvestrand <harald@alvestrand.no>, "public-media-capture@w3.org" <public-media-capture@w3.org>
On 27 February 2015 at 00:33, Stefan HÃ¥kansson LK
<stefan.lk.hakansson@ericsson.com> wrote:
> var p = navigator.mediaDevices.getUserMedia(options);
>
> followed by
>
> p.constructor.reject();

As Anne points out, that doesn't do anything useful.  What you need is
either something broader:

navigator.mediaDevices.getUserMedia(c)
 .catch(() => console.log('rejected 1'));
navigator.mediaDevices.getUserMedia(c)
 .catch(() => console.log('rejected 2'));
navigator.mediaDevices.cancelAllRequests()
  .then(() => console.log('cancel complete'));
// > rejected 2 // order of cancel is indeterminate
// > rejected 1
// > cancel complete

Or something that has a more complex surface area:

var gum = navigator.mediaDevices.getUserMedia(c);
gum.promise.catch(() => console.log('rejected'));
gum.cancel().then(() => console.log('cancel complete'));
// > rejected
// > cancel complete
Received on Thursday, 26 February 2015 21:18:48 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 26 February 2015 21:18:49 UTC