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

Side by Side Diff: adapter.js

Issue 12824011: Updated Chrome Test pages (Closed) Base URL: https://src.chromium.org/svn/trunk/src/chrome/test/data/webrtc/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | getusermedia.js » ('j') | getusermedia.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 var RTCPeerConnection = null;
kjellander_chromium 2013/03/15 09:14:06 Please do not add another copy of adapter.js here.
elham1 2013/03/21 22:36:27 Done.
2 var getUserMedia = null;
3 var attachMediaStream = null;
4
5 if (navigator.mozGetUserMedia) {
6 console.log("This appears to be Firefox");
7
8 // The RTCPeerConnection object.
9 RTCPeerConnection = mozRTCPeerConnection;
10
11 // Get UserMedia (only difference is the prefix).
12 // Code from Adam Barth.
13 getUserMedia = navigator.mozGetUserMedia.bind(navigator);
14
15 // Attach a media stream to an element.
16 attachMediaStream = function(element, stream) {
17 console.log("Attaching media stream");
18 element.mozSrcObject = stream;
19 element.play();
20 };
21 } else if (navigator.webkitGetUserMedia) {
22 console.log("This appears to be Chrome");
23
24 // The RTCPeerConnection object.
25 RTCPeerConnection = webkitRTCPeerConnection;
26
27 // Get UserMedia (only difference is the prefix).
28 // Code from Adam Barth.
29 getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
30
31 // Attach a media stream to an element.
32 attachMediaStream = function(element, stream) {
33 element.src = webkitURL.createObjectURL(stream);
34 };
35
36 // The representation of tracks in a stream is changed in M26.
37 // Unify them for earlier Chrome versions in the coexisting period.
38 if (!webkitMediaStream.prototype.getVideoTracks) {
39 webkitMediaStream.prototype.getVideoTracks = function() {
40 return this.videoTracks;
41 }
42 }
43
44 if (!webkitMediaStream.prototype.getAudioTracks) {
45 webkitMediaStream.prototype.getAudioTracks = function() {
46 return this.audioTracks;
47 }
48 }
49 } else {
50 console.log("Browser does not appear to be WebRTC-capable");
51 }
OLDNEW
« no previous file with comments | « no previous file | getusermedia.js » ('j') | getusermedia.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698