| 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 768ef7116d8682d10875f6e7ab95cbec208b86eb..3310504efa691cd23a3cfc18466cabeaa1377d53 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -13401,7 +13401,7 @@ class MediaSource extends EventTarget native "*MediaSource" {
|
| /// @domName MediaSource.removeSourceBuffer; @docsEditable true
|
| void removeSourceBuffer(SourceBuffer buffer) native;
|
| }
|
| -// 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.
|
|
|
| @@ -13444,6 +13444,22 @@ class MediaStream extends EventTarget native "*MediaStream" {
|
| /// @domName MediaStream.removeEventListener; @docsEditable true
|
| @JSName('removeEventListener')
|
| void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
|
| +
|
| +
|
| + /**
|
| + * Checks if the MediaStream APIs are supported on the current platform.
|
| + *
|
| + * See also:
|
| + *
|
| + * * [Navigator.getUserMedia]
|
| + */
|
| + static bool get supported =>
|
| + JS('bool', '''!!(#.getUserMedia || #.webkitGetUserMedia ||
|
| + #.mozGetUserMedia || #.msGetUserMedia)''',
|
| + window.navigator,
|
| + window.navigator,
|
| + window.navigator,
|
| + window.navigator);
|
| }
|
|
|
| /// @docsEditable true
|
| @@ -14308,6 +14324,56 @@ class Navigator native "*Navigator" {
|
| String get language => JS('String', '#.language || #.userLanguage', this,
|
| this);
|
|
|
| + /**
|
| + * 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
|
| + };
|
| + _ensureGetUserMedia();
|
| + this._getUserMedia(convertDartToNative_Dictionary(options),
|
| + (stream) {
|
| + completer.complete(stream);
|
| + },
|
| + (error) {
|
| + completer.completeError(error);
|
| + });
|
| + return completer.future;
|
| + }
|
| +
|
| + _ensureGetUserMedia() {
|
| + if (JS('bool', '!(#.getUserMedia)', this)) {
|
| + JS('void', '#.getUserMedia = '
|
| + '(#.getUserMedia || #.webkitGetUserMedia || #.mozGetUserMedia ||'
|
| + '#.msGetUserMedia)', this, this, this, this, this);
|
| + }
|
| + }
|
| +
|
| + @JSName('getUserMedia')
|
| + void _getUserMedia(options, _NavigatorUserMediaSuccessCallback success,
|
| + _NavigatorUserMediaErrorCallback error) native;
|
| +
|
| +
|
| /// @domName Navigator.appCodeName; @docsEditable true
|
| final String appCodeName;
|
|
|
| @@ -14363,22 +14429,6 @@ class Navigator native "*Navigator" {
|
| @Returns('_GamepadList') @Creates('_GamepadList')
|
| List<Gamepad> webkitGetGamepads() native;
|
|
|
| - /// @domName Navigator.webkitGetUserMedia; @docsEditable true
|
| - void webkitGetUserMedia(Map options, NavigatorUserMediaSuccessCallback successCallback, [NavigatorUserMediaErrorCallback errorCallback]) {
|
| - if (?errorCallback) {
|
| - var options_1 = convertDartToNative_Dictionary(options);
|
| - _webkitGetUserMedia_1(options_1, successCallback, errorCallback);
|
| - return;
|
| - }
|
| - var options_2 = convertDartToNative_Dictionary(options);
|
| - _webkitGetUserMedia_2(options_2, successCallback);
|
| - return;
|
| - }
|
| - @JSName('webkitGetUserMedia')
|
| - void _webkitGetUserMedia_1(options, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback) native;
|
| - @JSName('webkitGetUserMedia')
|
| - void _webkitGetUserMedia_2(options, NavigatorUserMediaSuccessCallback successCallback) native;
|
| -
|
| }
|
| // 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
|
| @@ -14400,7 +14450,7 @@ class NavigatorUserMediaError native "*NavigatorUserMediaError" {
|
| // 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.
|
| @@ -14408,7 +14458,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.
|
|
|