W3C home > Mailing lists > Public > public-media-capture@w3.org > October 2014

Re: Promise slides

From: Adam Roach <adam@nostrum.com>
Date: Thu, 02 Oct 2014 09:03:04 -0500
Message-ID: <542D5B18.90509@nostrum.com>
To: Jan-Ivar Bruaroey <jib@mozilla.com>, "public-media-capture@w3.org" <public-media-capture@w3.org>
On 9/30/14 02:14, Jan-Ivar Bruaroey wrote:
> Here are the slides.
>
> .: Jan-Ivar :.

Sorry for falling a bit behind on the issue, but I just want to make 
sure I understand what's under discussion here. Fundamentally, this 
looks like a proposal to delay spec publication for a change that can be 
retrofit with a small handful of lines of code:


navigator.oldGum = navigator.getUserMedia ||
                    navigator.mozGetUserMedia ||
                    navigator.webkitGetUserMedia;

navigator.getUserMedia =
function(constraints, successCallback, errorCallback) {
   return new Promise(function(resolve, reject){
     try {
       navigator.oldGum(constraints,
         function(stream) {
           resolve(stream);
           if (successCallback)
             successCallback(stream);
         },
         function(error) {
           reject(error);
           if (errorCallback)
             errorCallback(error);
         });
       } catch (error) {
         reject(error);
         if (successCallback || errorCallback)
           throw(error);
       }
   });
};


Is that right? Would it make more sense to publish this somewhere so 
that users interested in promises can use them, while giving the rest of 
the world a finalized v1 spec?

/a
Received on Thursday, 2 October 2014 14:03:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:26:30 UTC