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

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('', 'window[#]',
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 the given time.
17350 try { 17356 try {
17351 var c = new RtcPeerConnection({"iceServers": [ {"url":"stun:foo.com"}]}); 17357 new RtcPeerConnection(
17352 return c is RtcPeerConnection; 17358 {"iceServers": [ {"url":"stun:localhost"}]});
17353 } catch (_) {} 17359 return true;
17360 } catch (_) { return false;}
17354 return false; 17361 return false;
17355 } 17362 }
17356 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) { 17363 Future<RtcSessionDescription> createOffer([Map mediaConstraints]) {
17357 var completer = new Completer<RtcSessionDescription>(); 17364 var completer = new Completer<RtcSessionDescription>();
17358 _createOffer( 17365 _createOffer(
17359 (value) { completer.complete(value); }, 17366 (value) { completer.complete(value); },
17360 (error) { completer.completeError(error); }, mediaConstraints); 17367 (error) { completer.completeError(error); }, mediaConstraints);
17361 return completer.future; 17368 return completer.future;
17362 } 17369 }
17363 17370
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
17626 17633
17627 @DomName('RTCPeerConnection.onremovestream') 17634 @DomName('RTCPeerConnection.onremovestream')
17628 @DocsEditable 17635 @DocsEditable
17629 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s); 17636 Stream<MediaStreamEvent> get onRemoveStream => removeStreamEvent.forTarget(thi s);
17630 17637
17631 @DomName('RTCPeerConnection.onsignalingstatechange') 17638 @DomName('RTCPeerConnection.onsignalingstatechange')
17632 @DocsEditable 17639 @DocsEditable
17633 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this); 17640 Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarge t(this);
17634 17641
17635 } 17642 }
17636
17637
17638 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 17643 // 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 17644 // 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. 17645 // BSD-style license that can be found in the LICENSE file.
17641 17646
17642 17647
17643 @DomName('RTCSessionDescription') 17648 @DomName('RTCSessionDescription')
17644 @SupportedBrowser(SupportedBrowser.CHROME) 17649 @SupportedBrowser(SupportedBrowser.CHROME)
17645 @Experimental 17650 @Experimental
17646 class RtcSessionDescription native "RTCSessionDescription" { 17651 class RtcSessionDescription native "RTCSessionDescription" {
17647 factory RtcSessionDescription(Map dictionary) { 17652 factory RtcSessionDescription(Map dictionary) {
17648 return JS('RtcSessionDescription', 'new RTCSessionDescription(#)', 17653 // TODO(efortuna): Remove this check if when you can actually construct with
17654 // the unprefixed RTCIceCandidate in Firefox (currently both are defined,
17655 // but one can't be used as a constructor).
17656 var constructorName = JS('', 'window[#]',
17657 Device.isFirefox ? '${Device.propertyPrefix}RTCSessionDescription' :
17658 'RTCSessionDescription');
17659 return JS('RtcSessionDescription',
17660 'new #(#)', constructorName,
17649 convertDartToNative_SerializedScriptValue(dictionary)); 17661 convertDartToNative_SerializedScriptValue(dictionary));
17650 } 17662 }
17651 17663
17652 @DomName('RTCSessionDescription.sdp') 17664 @DomName('RTCSessionDescription.sdp')
17653 @DocsEditable 17665 @DocsEditable
17654 String sdp; 17666 String sdp;
17655 17667
17656 @DomName('RTCSessionDescription.type') 17668 @DomName('RTCSessionDescription.type')
17657 @DocsEditable 17669 @DocsEditable
17658 String type; 17670 String type;
(...skipping 10693 matching lines...) Expand 10 before | Expand all | Expand 10 after
28352 _position = nextPosition; 28364 _position = nextPosition;
28353 return true; 28365 return true;
28354 } 28366 }
28355 _current = null; 28367 _current = null;
28356 _position = _array.length; 28368 _position = _array.length;
28357 return false; 28369 return false;
28358 } 28370 }
28359 28371
28360 T get current => _current; 28372 T get current => _current;
28361 } 28373 }
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