title: adding support for navigator.mediaDevices.getUserMedia to Dart
body: <p>The Dart SDK does not yet have support for certain methods in the MediaDevices class, including getUserMedia <a href="https://github.com/dart-lang/sdk/issues/35253" rel="nofollow noreferrer">https://github.com/dart-lang/sdk/issues/35253</a>. For browsers like Chrome and Firefox, this has been okay because an older callback-based implementation of getUserMedia is still found directly on the window.navigator object. But with Safari, which I think only implemented this functionality more recently, only the newer MediaDevices variant which returns a promise is supported.</p>
  
  <p>I'm struggling to figure out how to add this method to Dart's existing MediaDevices class so that it can call the native javascript function, handle the resulting promise and convert the result that's passed on success back into a Dart MediaStream object. </p>
  
  <p>There is an old post here which seemed promising, but I can't make that example run successfully now and suspect it's either irrelevant for Dart 2+, or irrelevant if the Dart class already exists (which is what the error I get indicates). <a href="https://stackoverflow.com/questions/34572517/dart-js-interop-0-6-0-and-js-promises-resolving">Dart JS Interop 0.6.0 and JS Promises - resolving</a></p>
  
  <p>The closest I've come to success is to go back to Dart's older JsObject interop approach. I can call the getUserMedia method and receive a promise object, but currently it's always failing with an error that states I must request audio or video. So there's something wrong with my parameter syntax or for how it's getting converted to JS:</p>
  
  <pre><code>JsObject jsObj = context['navigator']['mediaDevices'];
  JsObject promise = jsObj.callMethod("getUserMedia", 
      [{'audio': true, 'video': false}]);
  promise.callMethod('then', [
      (_){ 
          completer.complete(true); 
          print('success...'); 
      }, 
      (e){ 
          completer.complete(false); 
          print('fail...'); 
      }
  ]);
  </code></pre>
  
  <p>However, even if I get past this, I still don't see how to convert the result back into a Dart MediaStream object. Does anyone know of any information available for filling in missing SDK pieces like this? </p>