I've seen the following:
chrome://webrtc-internals
However I'm looking for a way to let users click a button from within the web app to either download or - preferably - POST
WebRtc logs to an endpoint baked into the app. The idea is that I can enable non-technical users to share technical logs with me through the click of a UI button.
How can this be achieved?
Note: This should not be dependent on Chrome; Chromium will also be used as the app will be wrapped up in Electron.
I've seen the following:
chrome://webrtc-internals
However I'm looking for a way to let users click a button from within the web app to either download or - preferably - POST
WebRtc logs to an endpoint baked into the app. The idea is that I can enable non-technical users to share technical logs with me through the click of a UI button.
How can this be achieved?
Note: This should not be dependent on Chrome; Chromium will also be used as the app will be wrapped up in Electron.
Share Improve this question edited Jul 5, 2017 at 21:45 SB2055 asked Jul 5, 2017 at 20:59 SB2055SB2055 12.9k37 gold badges104 silver badges205 bronze badges 2-
1
Perhaps this answer should help: Is there an API for the
chrome://webrtc-internals/
variables in JavaScript? – Dheeraj Vepakomma Commented Jul 9, 2017 at 9:35 - 1 @DheerajV.S. thanks - using that I built a little stats extractor posted below. – SB2055 Commented Jul 9, 2017 at 15:49
3 Answers
Reset to default 3 +50You need to write a javascript equivalent that captures all RTCPeerConnection API calls. rtcstats.js does that but sends all data to a server. If you replace that behaviour with storing it in memory you should be good.
This is what I ended up using (replace knockout with underscore or whatever):
connectionReport.signalingState = connection.signalingState;
connectionReport.stats = [];
connection.getStats(function (stats) {
const reportCollection = stats.result();
ko.utils.arrayForEach(reportCollection, function (innerReport) {
const statReport = {};
statReport.id = innerReport.id;
statReport.type = innerReport.type;
const keys = innerReport.names();
ko.utils.arrayForEach(keys, function (reportKey) {
statReport[reportKey] = innerReport.stat(reportKey);
})
connectionReport.stats.push(statReport);
});
connectionStats.push(connectionReport);
});
UPDATE:
It appears that this getStats
mechanism is soon-to-be-deprecated.
Reading through js source of chrome://webrtc-internals
, I noticed that the web page is using a method called chrome.send()
to send messages like chrome.send('enableEventLogRecordings');
, to execute logging mands.
According to here:
chrome.send() is a private function only available to internal chrome pages.
so the function is sandboxed which makes accessing to it not possible