|
|
|
@ -9,6 +9,7 @@ var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js"); |
|
|
|
|
var XMPPEvents = require("../../service/xmpp/XMPPEvents"); |
|
|
|
|
var CallStats = require("./CallStats"); |
|
|
|
|
var RTCEvents = require("../../service/RTC/RTCEvents"); |
|
|
|
|
var StatisticsEvents = require("../../service/statistics/Events"); |
|
|
|
|
|
|
|
|
|
var eventEmitter = new EventEmitter(); |
|
|
|
|
|
|
|
|
@ -26,7 +27,7 @@ function stopLocal() { |
|
|
|
|
function stopRemote() { |
|
|
|
|
if (rtpStats) { |
|
|
|
|
rtpStats.stop(); |
|
|
|
|
eventEmitter.emit("statistics.stop"); |
|
|
|
|
eventEmitter.emit(StatisticsEvents.STOP); |
|
|
|
|
rtpStats = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -66,37 +67,12 @@ var statistics = { |
|
|
|
|
*/ |
|
|
|
|
LOCAL_JID: 'local', |
|
|
|
|
|
|
|
|
|
addAudioLevelListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.on("statistics.audioLevel", listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
removeAudioLevelListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.removeListener("statistics.audioLevel", listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addConnectionStatsListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.on("statistics.connectionstats", listener); |
|
|
|
|
addListener: function(type, listener) { |
|
|
|
|
eventEmitter.on(type, listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
removeConnectionStatsListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.removeListener("statistics.connectionstats", listener); |
|
|
|
|
removeListener: function (type, listener) { |
|
|
|
|
eventEmitter.removeListener(type, listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addRemoteStatsStopListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.on("statistics.stop", listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
removeRemoteStatsStopListener: function(listener) |
|
|
|
|
{ |
|
|
|
|
eventEmitter.removeListener("statistics.stop", listener); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
stop: function () { |
|
|
|
|
stopLocal(); |
|
|
|
|
stopRemote(); |
|
|
|
@ -105,12 +81,10 @@ var statistics = { |
|
|
|
|
eventEmitter.removeAllListeners(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
stopRemoteStatistics: function() |
|
|
|
|
{ |
|
|
|
|
stopRemote(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
start: function () { |
|
|
|
|
APP.RTC.addStreamListener(onStreamCreated, |
|
|
|
|
StreamEventTypes.EVENT_TYPE_LOCAL_CREATED); |
|
|
|
|