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

Unified Diff: tools/dom/templates/html/impl/impl_Navigator.darttemplate

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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/interactive_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Navigator.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Navigator.darttemplate b/tools/dom/templates/html/impl/impl_Navigator.darttemplate
index 9d8d8c4ceaee68476366db2ea8325ef039e9aad2..e6ffe05861c5acb310f5c3a508b2fd36de76d837 100644
--- a/tools/dom/templates/html/impl/impl_Navigator.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Navigator.darttemplate
@@ -16,25 +16,41 @@ $endif
* 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` (stream does
+ * not use audio or video, respectively).
*
- * Example use:
+ * Simple example usage:
*
- * window.navigator.getUserMedia(audio:true, video: true).then((stream) {
+ * window.navigator.getUserMedia(audio: true, video: true).then((stream) {
* var video = new VideoElement()
* ..autoplay = true
* ..src = Url.createObjectUrl(stream);
* document.body.append(video);
* });
*
+ * The user can also pass in Maps to the audio or video parameters 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. The particular
+ * constraint names for audio and video are still in flux, but as of this
+ * writing, here is an example providing more constraints.
+ *
+ * window.navigator.getUserMedia(
+ * audio: true,
+ * video: {'mandatory':
+ * { 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
+ * 'optional':
+ * [{ 'minFrameRate': 60 },
+ * { 'maxWidth': 640 }]
+ * });
+ *
* See also:
* * [MediaStream.supported]
*/
@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,
@@ -42,7 +58,7 @@ $endif
};
$if DART2JS
_ensureGetUserMedia();
- this._getUserMedia(convertDartToNative_Dictionary(options),
+ this._getUserMedia(convertDartToNative_SerializedScriptValue(options),
(stream) {
completer.complete(stream);
},
« no previous file with comments | « tests/html/interactive_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698