initial tracking infrastructure

This commit is contained in:
Philipp Hancke 2014-08-25 12:30:31 +02:00
parent 7f9bf974fb
commit dacafdeb8a
3 changed files with 35 additions and 0 deletions

33
app.js
View File

@ -575,6 +575,39 @@ $(document).bind('setLocalDescription.jingle', function (event, sid) {
}
});
$(document).bind('iceconnectionstatechange.jingle', function (event, sid, session) {
switch (session.peerconnection.iceConnectionState) {
case 'checking':
session.timeChecking = (new Date()).getTime();
session.firstconnect = true;
break;
case 'completed': // on caller side
case 'connected':
if (session.firstconnect) {
session.firstconnect = false;
var metadata = {};
metadata.setupTime = (new Date()).getTime() - session.timeChecking;
session.peerconnection.getStats(function (res) {
res.result().forEach(function (report) {
if (report.type == 'googCandidatePair' && report.stat('googActiveConnection') == 'true') {
metadata.localCandidateType = report.stat('googLocalCandidateType');
metadata.remoteCandidateType = report.stat('googRemoteCandidateType');
// log pair as well so we can get nice pie charts
metadata.candidatePair = report.stat('googLocalCandidateType') + ';' + report.stat('googRemoteCandidateType');
if (report.stat('googRemoteAddress').indexOf('[') === 0) {
metadata.ipv6 = true;
}
}
});
trackUsage('iceConnected', metadata);
});
}
break;
}
});
$(document).bind('joined.muc', function (event, jid, info) {
updateRoomUrl(window.location.href);
document.getElementById('localNick').appendChild(

View File

@ -47,6 +47,7 @@
<script src="audio_levels.js?v=1"></script><!-- audio levels plugin -->
<script src="media_stream.js?v=1"></script><!-- media stream -->
<script src="bottom_toolbar.js?v=1"></script><!-- media stream -->
<script src="tracking.js?v=1"></script><!-- tracking -->
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="css/font.css?v=3"/>
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=23"/>

View File

@ -125,6 +125,7 @@ ColibriFocus.prototype.makeConference = function (peers) {
window.setTimeout(function() { self.modifySources(); }, 1000);
}
*/
$(document).trigger('iceconnectionstatechange.jingle', [self.sid, self]);
};
this.peerconnection.onsignalingstatechange = function (event) {
console.warn(self.peerconnection.signalingState);