Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 12695014: Enable getUserMedia to take constraints for its parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 89b0ec794cedbca914188cd13de5dc362af789ad..f995cf87c2bce337ae405698337045fec626e3ef 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -17386,11 +17386,22 @@ class Navigator native "*Navigator" {
* Gets a stream (video and or audio) from the local computer.
*
* Use [MediaStream.supported] to check if this is supported by the current
- * platform.
+ * platform. The arguments `audio` and `video` default to `false` (no
+ * constraints), but will accept Maps in each parameter to specify mandatory
+ * and optional constraints for the media stream. Not passing in a map, but
+ * passing in `true` will provide a LocalMediaStream with audio or video
+ * capabilities, but without any additional constraints.
*
* Example use:
*
- * window.navigator.getUserMedia(audio:true, video: true).then((stream) {
+ * window.navigator.getUserMedia(
+ * audio: true,
+ * video: {'mandatory':
+ * { 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
+ * 'optional':
+ * [{ 'minFrameRate': 60 },
+ * { 'maxWidth': 640 }]
+ * }).then((stream) {
* var video = new VideoElement()
* ..autoplay = true
* ..src = Url.createObjectUrl(stream);
@@ -17403,15 +17414,15 @@ class Navigator native "*Navigator" {
@DomName('Navigator.webkitGetUserMedia')
@SupportedBrowser(SupportedBrowser.CHROME)
@Experimental
- Future<LocalMediaStream> getUserMedia({bool audio: false,
- bool video: false}) {
+ Future<LocalMediaStream> getUserMedia({audio: false,
+ video: false}) {
var completer = new Completer<LocalMediaStream>();
var options = {
'audio': audio,
'video': video
};
_ensureGetUserMedia();
- this._getUserMedia(convertDartToNative_Dictionary(options),
+ this._getUserMedia(convertDartToNative_SerializedScriptValue(options),
(stream) {
completer.complete(stream);
},
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | tools/dom/templates/html/impl/impl_Navigator.darttemplate » ('J')

Powered by Google App Engine
This is Rietveld 408576698