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

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 var constructorName = JS('RtcIceCandidate', 'window[#]',
17290 Device.isFirefox ? '${Device.propertyPrefix}RTCIceCandidate' :
blois 2013/05/24 21:42:59 Better to do something like: new (window.RTCIceCa
Emily Fortuna 2013/05/24 22:40:54 As discussed offline, this doesn't work because RT
17291 'RTCIceCandidate');
17292 return JS('RtcIceCandidate', 'new #(#)', constructorName,
17290 convertDartToNative_SerializedScriptValue(dictionary)); 17293 convertDartToNative_SerializedScriptValue(dictionary));
17291 } 17294 }
17292 17295
17293 @DomName('RTCIceCandidate.candidate') 17296 @DomName('RTCIceCandidate.candidate')
17294 @DocsEditable 17297 @DocsEditable
17295 final String candidate; 17298 final String candidate;
17296 17299
17297 @DomName('RTCIceCandidate.sdpMLineIndex') 17300 @DomName('RTCIceCandidate.sdpMLineIndex')
17298 @DocsEditable 17301 @DocsEditable
17299 final int sdpMLineIndex; 17302 final int sdpMLineIndex;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
17339 } 17342 }
17340 17343
17341 /** 17344 /**
17342 * Checks if Real Time Communication (RTC) APIs are supported and enabled on 17345 * Checks if Real Time Communication (RTC) APIs are supported and enabled on
17343 * the current platform. 17346 * the current platform.
17344 */ 17347 */
17345 static bool get supported { 17348 static bool get supported {
17346 // Currently in Firefox some of the RTC elements are defined but throw an 17349 // Currently in Firefox some of the RTC elements are defined but throw an
17347 // error unless the user has specifically enabled them in their 17350 // 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 17351 // about:config. So we have to construct an element to actually test if RTC
17349 // is supported at at the given time. 17352 // is supported at at the given time. Additionally, Firefox only supports IP
17353 // numbers (currently), so we test with a random IP address.
17354 // See https://bugzilla.mozilla.org/show_bug.cgi?id=837919 for details.
17350 try { 17355 try {
17351 var c = new RtcPeerConnection({"iceServers": [ {"url":"stun:foo.com"}]}); 17356 var c = new RtcPeerConnection(
17357 {"iceServers": [ {"url":"stun:216.93.246.18"}]});
blois 2013/05/24 21:42:59 This feels very hacky for a supported check. Can w
Emily Fortuna 2013/05/24 22:40:54 The deal is, the basic type always "exists" in fir
17352 return c is RtcPeerConnection; 17358 return c is RtcPeerConnection;
17353 } catch (_) {} 17359 } catch (_) {}
17354 return false; 17360 return false;
17355 } 17361 }
17356 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) { 17362 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) {
17357 var completer = new Completer<RtcSessionDescription>(); 17363 var completer = new Completer<RtcSessionDescription>();
17358 _createOffer( 17364 _createOffer(
17359 (value) { completer.complete(value); }, 17365 (value) { completer.complete(value); },
17360 (error) { completer.completeError(error); }, mediaConstraints); 17366 (error) { completer.completeError(error); }, mediaConstraints);
17361 return completer.future; 17367 return completer.future;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
17626 17632
17627 @DomName('RTCPeerConnection.onremovestream') 17633 @DomName('RTCPeerConnection.onremovestream')
17628 @DocsEditable 17634 @DocsEditable
17629 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s); 17635 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s);
17630 17636
17631 @DomName('RTCPeerConnection.onsignalingstatechange') 17637 @DomName('RTCPeerConnection.onsignalingstatechange')
17632 @DocsEditable 17638 @DocsEditable
17633 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this); 17639 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this);
17634 17640
17635 } 17641 }
17636
17637
17638 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 17642 // 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 17643 // 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. 17644 // BSD-style license that can be found in the LICENSE file.
17641 17645
17642 17646
17643 @DomName('RTCSessionDescription') 17647 @DomName('RTCSessionDescription')
17644 @SupportedBrowser(SupportedBrowser.CHROME) 17648 @SupportedBrowser(SupportedBrowser.CHROME)
17645 @Experimental 17649 @Experimental
17646 class RtcSessionDescription native "RTCSessionDescription" { 17650 class RtcSessionDescription native "RTCSessionDescription" {
17647 factory RtcSessionDescription(Map dictionary) { 17651 factory RtcSessionDescription(Map dictionary) {
17648 return JS('RtcSessionDescription', 'new RTCSessionDescription(#)', 17652 var constructorName = JS('RtcSessionDescription', 'window[#]',
17653 Device.isFirefox ? '${Device.propertyPrefix}RTCSessionDescription' :
17654 'RTCSessionDescription');
17655 return JS('RtcSessionDescription',
17656 'new #(#)', constructorName,
blois 2013/05/24 21:42:59 Ditto from earlier comment.
17649 convertDartToNative_SerializedScriptValue(dictionary)); 17657 convertDartToNative_SerializedScriptValue(dictionary));
17650 } 17658 }
17651 17659
17652 @DomName('RTCSessionDescription.sdp') 17660 @DomName('RTCSessionDescription.sdp')
17653 @DocsEditable 17661 @DocsEditable
17654 String sdp; 17662 String sdp;
17655 17663
17656 @DomName('RTCSessionDescription.type') 17664 @DomName('RTCSessionDescription.type')
17657 @DocsEditable 17665 @DocsEditable
17658 String type; 17666 String type;
(...skipping 10693 matching lines...) Expand 10 before | Expand all | Expand 10 after
28352 _position = nextPosition; 28360 _position = nextPosition;
28353 return true; 28361 return true;
28354 } 28362 }
28355 _current = null; 28363 _current = null;
28356 _position = _array.length; 28364 _position = _array.length;
28357 return false; 28365 return false;
28358 } 28366 }
28359 28367
28360 T get current => _current; 28368 T get current => _current;
28361 } 28369 }
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