Anton Shestakov <engored@ya.ru>, Tue, 12 Mar 2013 02:23:34 +0900
Status bar. Also could not resist dragging jQuery in.
static/js/webrtc-adapter.js
Permissions: -rw-r--r--
var RTCPeerConnection = null; var attachMediaStream = null; var reattachMediaStream = null; var webrtcDetectedBrowser = null; if (navigator.mozGetUserMedia) { console.log("This appears to be Firefox"); webrtcDetectedBrowser = "firefox"; // The RTCPeerConnection object. RTCPeerConnection = mozRTCPeerConnection; // The RTCSessionDescription object. RTCSessionDescription = Object; // The RTCIceCandidate object. RTCIceCandidate = mozRTCIceCandidate; // Get UserMedia (only difference is the prefix). getUserMedia = navigator.mozGetUserMedia.bind(navigator); // Attach a media stream to an element. attachMediaStream = function(element, stream) { console.log("Attaching media stream"); element.src = URL.createObjectURL(stream);; reattachMediaStream = function(to, from) { console.log("Reattaching media stream"); to.mozSrcObject = from.mozSrcObject; // Fake get{Video,Audio}Tracks MediaStream.prototype.getVideoTracks = function() { MediaStream.prototype.getAudioTracks = function() { } else if (navigator.webkitGetUserMedia) { console.log("This appears to be Chrome"); webrtcDetectedBrowser = "chrome"; // The RTCPeerConnection object. RTCPeerConnection = webkitRTCPeerConnection; // Get UserMedia (only difference is the prefix). getUserMedia = navigator.webkitGetUserMedia.bind(navigator); // Attach a media stream to an element. attachMediaStream = function(element, stream) { element.src = webkitURL.createObjectURL(stream); reattachMediaStream = function(to, from) { // The representation of tracks in a stream is changed in M26. // Unify them for earlier Chrome versions in the coexisting period. if (!webkitMediaStream.prototype.getVideoTracks) { webkitMediaStream.prototype.getVideoTracks = function() { webkitMediaStream.prototype.getAudioTracks = function() { // New syntax of getXXXStreams method in M26. if (!webkitRTCPeerConnection.prototype.getLocalStreams) { webkitRTCPeerConnection.prototype.getLocalStreams = function() { return this.localStreams; webkitRTCPeerConnection.prototype.getRemoteStreams = function() { return this.remoteStreams; console.log("Browser does not appear to be WebRTC-capable");