Re: Towards a getUserMedia/enumerateDevices fingerprinting solution

On 2/27/19 1:33 AM, Philipp Hancke wrote:
> There is a more basic use-case: what arguments should you use in the 
> getUserMedia call? Simply calling
>   getUserMedia({audio: true, video: true})
>
> will result in NotFoundError if either camera or microphone are not 
> present. Using enumerateDevices before to determine if a camera and/or 
> microphone are available is "better" than handling NotFoundError in a 
> trial-and-error manner.


How is it "better"? You mean like this 
https://stackoverflow.com/a/33770858/918910 ? This seems equivalent to me:

   try {
     stream = await navigator.mediaDevices.getUserMedia({video: true, 
audio: true});
   } catch(e) {
     stream = await navigator.mediaDevices.getUserMedia({audio: true});
   } catch(e) {
     stream = await navigator.mediaDevices.getUserMedia({video: true});
   } catch(e) {
     console.log(e);
   }

> It also avoids two permission prompts which would result from parallel 
> GUM calls with just audio or video.


What I show above gives only one permission prompt in all browsers.


> Chrome used to give a best-effort result (i.e. no video track on the 
> resulting stream if there is no camera) but that turned out to have 
> other implications because it invalidated the reasonable assumption 
> that you get a video track when you ask for it or an error.


I believe that was Firefox?


.: Jan-Ivar :.

Received on Wednesday, 27 February 2019 13:45:01 UTC