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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 16023011: Make RTC work on Firefox (mostly). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev' hide Symbol; 6 import 'dart:_collection-dev' hide Symbol;
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 17268 matching lines...) Expand 10 before | Expand all | Expand 10 after
17279 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 17279 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
17280 // for details. All rights reserved. Use of this source code is governed by a 17280 // for details. All rights reserved. Use of this source code is governed by a
17281 // BSD-style license that can be found in the LICENSE file. 17281 // BSD-style license that can be found in the LICENSE file.
17282 17282
17283 17283
17284 @DomName('RTCIceCandidate') 17284 @DomName('RTCIceCandidate')
17285 @SupportedBrowser(SupportedBrowser.CHROME) 17285 @SupportedBrowser(SupportedBrowser.CHROME)
17286 @Experimental 17286 @Experimental
17287 class RtcIceCandidate native "RTCIceCandidate" { 17287 class RtcIceCandidate native "RTCIceCandidate" {
17288 factory RtcIceCandidate(Map dictionary) { 17288 factory RtcIceCandidate(Map dictionary) {
17289 return JS('RtcIceCandidate', 'new RTCIceCandidate(#)', 17289 // TODO(efortuna): Remove this check if when you can actually construct with
17290 // the unprefixed RTCIceCandidate in Firefox (currently both are defined,
17291 // but one can't be used as a constructor).
17292 var constructorName = JS('RtcIceCandidate', 'window[#]',
sra1 2013/05/24 22:53:43 The JavaScript constructor function is not an inst
Emily Fortuna 2013/05/24 23:47:25 Done.
17293 Device.isFirefox ? '${Device.propertyPrefix}RTCIceCandidate' :
17294 'RTCIceCandidate');
17295 return JS('RtcIceCandidate', 'new #(#)', constructorName,
17290 convertDartToNative_SerializedScriptValue(dictionary)); 17296 convertDartToNative_SerializedScriptValue(dictionary));
17291 } 17297 }
17292 17298
17293 @DomName('RTCIceCandidate.candidate') 17299 @DomName('RTCIceCandidate.candidate')
17294 @DocsEditable 17300 @DocsEditable
17295 final String candidate; 17301 final String candidate;
17296 17302
17297 @DomName('RTCIceCandidate.sdpMLineIndex') 17303 @DomName('RTCIceCandidate.sdpMLineIndex')
17298 @DocsEditable 17304 @DocsEditable
17299 final int sdpMLineIndex; 17305 final int sdpMLineIndex;
(...skipping 19 matching lines...) Expand all
17319 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 17325 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
17320 // for details. All rights reserved. Use of this source code is governed by a 17326 // for details. All rights reserved. Use of this source code is governed by a
17321 // BSD-style license that can be found in the LICENSE file. 17327 // BSD-style license that can be found in the LICENSE file.
17322 17328
17323 17329
17324 @DomName('RTCPeerConnection') 17330 @DomName('RTCPeerConnection')
17325 @SupportedBrowser(SupportedBrowser.CHROME) 17331 @SupportedBrowser(SupportedBrowser.CHROME)
17326 @Experimental 17332 @Experimental
17327 class RtcPeerConnection extends EventTarget native "RTCPeerConnection" { 17333 class RtcPeerConnection extends EventTarget native "RTCPeerConnection" {
17328 factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) { 17334 factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) {
17329 var constructorName = JS('RtcPeerConnection', 'window[#]', 17335 var constructorName = JS('RtcPeerConnection', 'window[#]',
sra1 2013/05/24 22:53:43 JS('', ...)
Emily Fortuna 2013/05/24 23:47:25 Done.
17330 '${Device.propertyPrefix}RTCPeerConnection'); 17336 '${Device.propertyPrefix}RTCPeerConnection');
17331 if (mediaConstraints != null) { 17337 if (mediaConstraints != null) {
17332 return JS('RtcPeerConnection', 'new #(#,#)', constructorName, 17338 return JS('RtcPeerConnection', 'new #(#,#)', constructorName,
17333 convertDartToNative_SerializedScriptValue(rtcIceServers), 17339 convertDartToNative_SerializedScriptValue(rtcIceServers),
17334 convertDartToNative_SerializedScriptValue(mediaConstraints)); 17340 convertDartToNative_SerializedScriptValue(mediaConstraints));
17335 } else { 17341 } else {
17336 return JS('RtcPeerConnection', 'new #(#)', constructorName, 17342 return JS('RtcPeerConnection', 'new #(#)', constructorName,
17337 convertDartToNative_SerializedScriptValue(rtcIceServers)); 17343 convertDartToNative_SerializedScriptValue(rtcIceServers));
17338 } 17344 }
17339 } 17345 }
17340 17346
17341 /** 17347 /**
17342 * Checks if Real Time Communication (RTC) APIs are supported and enabled on 17348 * Checks if Real Time Communication (RTC) APIs are supported and enabled on
17343 * the current platform. 17349 * the current platform.
17344 */ 17350 */
17345 static bool get supported { 17351 static bool get supported {
17346 // Currently in Firefox some of the RTC elements are defined but throw an 17352 // Currently in Firefox some of the RTC elements are defined but throw an
17347 // error unless the user has specifically enabled them in their 17353 // error unless the user has specifically enabled them in their
17348 // about:config. So we have to construct an element to actually test if RTC 17354 // about:config. So we have to construct an element to actually test if RTC
17349 // is supported at at the given time. 17355 // is supported at at the given time. Additionally, Firefox only supports IP
sra1 2013/05/24 22:53:43 s/at at/at/
Emily Fortuna 2013/05/24 23:47:25 Done.
17356 // numbers (currently), so we test with a random IP address.
17357 // See https://bugzilla.mozilla.org/show_bug.cgi?id=837919 for details.
17350 try { 17358 try {
17351 var c = new RtcPeerConnection({"iceServers": [ {"url":"stun:foo.com"}]}); 17359 var c = new RtcPeerConnection(
17360 {"iceServers": [ {"url":"stun:216.93.246.18"}]});
sra1 2013/05/24 22:53:43 So can this fail when the feature is supported? Wh
Emily Fortuna 2013/05/24 23:47:25 That error message seems extra sketchy. It appears
17352 return c is RtcPeerConnection; 17361 return c is RtcPeerConnection;
sra1 2013/05/24 22:53:43 How would this be false? The JS call says is is Rt
Emily Fortuna 2013/05/24 23:47:25 Good point. Just now checking if constructing the
17353 } catch (_) {} 17362 } catch (_) {}
17354 return false; 17363 return false;
17355 } 17364 }
17356 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) { 17365 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) {
17357 var completer = new Completer<RtcSessionDescription>(); 17366 var completer = new Completer<RtcSessionDescription>();
17358 _createOffer( 17367 _createOffer(
17359 (value) { completer.complete(value); }, 17368 (value) { completer.complete(value); },
17360 (error) { completer.completeError(error); }, mediaConstraints); 17369 (error) { completer.completeError(error); }, mediaConstraints);
17361 return completer.future; 17370 return completer.future;
17362 } 17371 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
17626 17635
17627 @DomName('RTCPeerConnection.onremovestream') 17636 @DomName('RTCPeerConnection.onremovestream')
17628 @DocsEditable 17637 @DocsEditable
17629 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s); 17638 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s);
17630 17639
17631 @DomName('RTCPeerConnection.onsignalingstatechange') 17640 @DomName('RTCPeerConnection.onsignalingstatechange')
17632 @DocsEditable 17641 @DocsEditable
17633 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this); 17642 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this);
17634 17643
17635 } 17644 }
17636
17637
17638 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 17645 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
17639 // for details. All rights reserved. Use of this source code is governed by a 17646 // for details. All rights reserved. Use of this source code is governed by a
17640 // BSD-style license that can be found in the LICENSE file. 17647 // BSD-style license that can be found in the LICENSE file.
17641 17648
17642 17649
17643 @DomName('RTCSessionDescription') 17650 @DomName('RTCSessionDescription')
17644 @SupportedBrowser(SupportedBrowser.CHROME) 17651 @SupportedBrowser(SupportedBrowser.CHROME)
17645 @Experimental 17652 @Experimental
17646 class RtcSessionDescription native "RTCSessionDescription" { 17653 class RtcSessionDescription native "RTCSessionDescription" {
17647 factory RtcSessionDescription(Map dictionary) { 17654 factory RtcSessionDescription(Map dictionary) {
17648 return JS('RtcSessionDescription', 'new RTCSessionDescription(#)', 17655 // TODO(efortuna): Remove this check if when you can actually construct with
17656 // the unprefixed RTCIceCandidate in Firefox (currently both are defined,
17657 // but one can't be used as a constructor).
sra1 2013/05/24 22:53:43 I'm not sure what 'this check' refers to. Looks li
Emily Fortuna 2013/05/24 23:47:25 Done.
17658 var constructorName = JS('RtcSessionDescription', 'window[#]',
sra1 2013/05/24 22:53:43 JS('', ....)
Emily Fortuna 2013/05/24 23:47:25 Done.
17659 '${Device.propertyPrefix}RTCSessionDescription' :
17660 'RTCSessionDescription');
17661 return JS('RtcSessionDescription',
17662 'new (RTCSessionDescription || mozRTCSessionDescription)(#)',
17649 convertDartToNative_SerializedScriptValue(dictionary)); 17663 convertDartToNative_SerializedScriptValue(dictionary));
17650 } 17664 }
17651 17665
17652 @DomName('RTCSessionDescription.sdp') 17666 @DomName('RTCSessionDescription.sdp')
17653 @DocsEditable 17667 @DocsEditable
17654 String sdp; 17668 String sdp;
17655 17669
17656 @DomName('RTCSessionDescription.type') 17670 @DomName('RTCSessionDescription.type')
17657 @DocsEditable 17671 @DocsEditable
17658 String type; 17672 String type;
(...skipping 10693 matching lines...) Expand 10 before | Expand all | Expand 10 after
28352 _position = nextPosition; 28366 _position = nextPosition;
28353 return true; 28367 return true;
28354 } 28368 }
28355 _current = null; 28369 _current = null;
28356 _position = _array.length; 28370 _position = _array.length;
28357 return false; 28371 return false;
28358 } 28372 }
28359 28373
28360 T get current => _current; 28374 T get current => _current;
28361 } 28375 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698