Skip to content

Instantly share code, notes, and snippets.

@y-i
Last active June 10, 2020 08:22
Show Gist options
  • Save y-i/b71f196bbbf4267c54ff1e4147033457 to your computer and use it in GitHub Desktop.
Save y-i/b71f196bbbf4267c54ff1e4147033457 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Offer Answer Sniffer
// @namespace http://tampermonkey.net/
// @version 0.1.0
// @description Sniff sLD/sRD
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
const orgSLD = RTCPeerConnection.prototype.setLocalDescription;
const orgSRD = RTCPeerConnection.prototype.setRemoteDescription;
RTCPeerConnection.prototype.setLocalDescription = function (sdp) {
console.log('sLD:', sdp.sdp);
return orgSLD.apply(this, [sdp]);
};
RTCPeerConnection.prototype.setRemoteDescription = function (sdp) {
console.log('sRD:', sdp.sdp);
return orgSRD.apply(this, [sdp]);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment