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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 11818066: Fixing up Navigator.getUserMedia. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 2cbde772bb0464dcd76e3f674b0a07d43508e260..cb1ed3851eec5438cb1aa3376a09ccdd656a70d1 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -9330,6 +9330,7 @@ abstract class Element extends Node implements ElementTraversal {
/** @domName Element.webkitMatchesSelector */
+ @Experimental()
bool matches(String selectors) native "Element_webkitMatchesSelector_Callback";
@@ -15868,14 +15869,12 @@ class MediaSource extends EventTarget {
void removeSourceBuffer(SourceBuffer buffer) native "MediaSource_removeSourceBuffer_Callback";
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// WARNING: Do not edit - generated code.
-
-/// @domName MediaStream
+/// @domName MediaStream; @docsEditable true
class MediaStream extends EventTarget {
MediaStream.internal() : super.internal();
@@ -15919,6 +15918,15 @@ class MediaStream extends EventTarget {
/** @domName MediaStream.removeEventListener */
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStream_removeEventListener_Callback";
+
+ /**
+ * Checks if the MediaStream APIs are supported on the current platform.
+ *
+ * See also:
+ *
+ * * [Navigator.getUserMedia]
+ */
+ static bool get supported => true;
}
/// @docsEditable true
@@ -16897,11 +16905,48 @@ class NamedNodeMap extends NativeFieldWrapperClass1 implements List<Node> {
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// WARNING: Do not edit - generated code.
-
-/// @domName Navigator
+/// @domName Navigator; @docsEditable true
class Navigator extends NativeFieldWrapperClass1 {
+
+
+ /**
+ * Gets a stream (video and or audio) from the local computer.
+ *
+ * Use [MediaStream.supported] to check if this is supported by the current
+ * platform.
+ *
+ * Example use:
+ *
+ * window.navigator.getUserMedia(audio:true, video: true).then((stream) {
+ * var video = new VideoElement()
+ * ..autoplay = true
+ * ..src = Url.createObjectUrl(stream);
+ * document.body.append(video);
+ * });
+ *
+ * See also:
+ * * [MediaStream.supported]
+ */
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @Experimental()
+ Future<LocalMediaStream> getUserMedia({bool audio=false, bool video=false}) {
+ var completer = new Completer<LocalMediaStream>();
+ var options = {
+ 'audio': audio,
+ 'video': video
+ };
+ this._getUserMedia(options,
+ (stream) {
+ completer.complete(stream);
+ },
+ (error) {
+ completer.completeError(error);
+ });
+ return completer.future;
+ }
+
+
Navigator.internal();
@@ -16982,7 +17027,9 @@ class Navigator extends NativeFieldWrapperClass1 {
/** @domName Navigator.webkitGetUserMedia */
- void webkitGetUserMedia(Map options, NavigatorUserMediaSuccessCallback successCallback, [NavigatorUserMediaErrorCallback errorCallback]) native "Navigator_webkitGetUserMedia_Callback";
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @Experimental()
+ void _getUserMedia(Map options, NavigatorUserMediaSuccessCallback successCallback, [NavigatorUserMediaErrorCallback errorCallback]) native "Navigator_webkitGetUserMedia_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -17010,7 +17057,7 @@ class NavigatorUserMediaError extends NativeFieldWrapperClass1 {
// WARNING: Do not edit - generated code.
-typedef void NavigatorUserMediaErrorCallback(NavigatorUserMediaError error);
+typedef void _NavigatorUserMediaErrorCallback(NavigatorUserMediaError error);
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -17018,7 +17065,7 @@ typedef void NavigatorUserMediaErrorCallback(NavigatorUserMediaError error);
// WARNING: Do not edit - generated code.
-typedef void NavigatorUserMediaSuccessCallback(LocalMediaStream stream);
+typedef void _NavigatorUserMediaSuccessCallback(LocalMediaStream stream);
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698