Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable users of a WebRtc app to download webrtc logs via javascript

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.

like image 732
SB2055 Avatar asked Jul 05 '17 20:07

SB2055


People also ask

How do I collect webrtc logs?

Chrome web browser Go back to the "chrome://webrtc-internals/" tab, there will be at least two tabs: GetUserMedia Requests and https://your/appllication/url. You will see logs along with stats graphs. Choose the tab with the name of your application and save the page content as Web Page, Complete.

How do I read webrtc internals?

You need to type “chrome://webrtc-internals/” for Chrome and “about:webrtc” for Firefox to get statistics during WebRTC communication. Based on the information that they provide, the Chrome tool seems to be more advanced in terms of the variety of information.


2 Answers

You 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.

like image 164
Philipp Hancke Avatar answered Sep 18 '22 18:09

Philipp Hancke


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.

like image 44
SB2055 Avatar answered Sep 19 '22 18:09

SB2055