docs: function _getStats(peer, lastResults, successCallback, errorCallback) {
      var statistic = {
          'local': {
              'audio': {},
              'video': {},
              'candidate': {}
          },
          'remote': {
              'audio': {},
              'video': {},
              'candidate': {}
          }
      };
  
      if (Helpers.getVersionFirefox()) {
          var localStream = peer.getLocalStreams().length ? peer.getLocalStreams()[0] : peer.delegate.localStream,
              localVideoSettings = localStream.getVideoTracks().length ? localStream.getVideoTracks()[0].getSettings() : null;
  
          statistic.local.video.frameHeight = localVideoSettings && localVideoSettings.height;
          statistic.local.video.frameWidth = localVideoSettings && localVideoSettings.width;
      }
  
      peer.getStats(null).then(function(results) {
          results.forEach(function(result) {
              var item;
  
              if (result.bytesReceived && result.type === 'inbound-rtp') {
                  item = statistic.remote[result.mediaType];
                  item.bitrate = _getBitratePerSecond(result, lastResults, false);   
                  item.bytesReceived = result.bytesReceived;
                  item.packetsReceived = result.packetsReceived;
                  item.timestamp = result.timestamp;
                  if (result.mediaType === 'video' && result.framerateMean) {
                      item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
                  }
              } else if (result.bytesSent && result.type === 'outbound-rtp') {
                  item = statistic.local[result.mediaType];
                  item.bitrate = _getBitratePerSecond(result, lastResults, true);
                  item.bytesSent = result.bytesSent;
                  item.packetsSent = result.packetsSent;
                  item.timestamp = result.timestamp;
                  if (result.mediaType === 'video' && result.framerateMean) {
                      item.framesPerSecond = Math.round(result.framerateMean * 10) / 10;
                  }
              } else if (result.type === 'local-candidate') {
                  item = statistic.local.candidate;
                  if (result.candidateType === 'host' && result.mozLocalTransport === 'udp' && result.transport === 'udp') {
                      item.protocol = result.transport;
                      item.ip = result.ipAddress;
                      item.port = result.portNumber;
                  } else if (!Helpers.getVersionFirefox()) {                 
                      item.protocol = result.protocol;
                      item.ip = result.ip;
                      item.port = result.port;
                  }
              } else if (result.type === 'remote-candidate') {
                  item = statistic.remote.candidate;
                  item.protocol = result.protocol || result.transport;
                  item.ip = result.ip || result.ipAddress;
                  item.port = result.port || result.portNumber;
              } else if (result.type === 'track' && result.kind === 'video' && !Helpers.getVersionFirefox()) {
                  if (result.remoteSource) {
                      item = statistic.remote.video;
                      item.frameHeight = result.frameHeight;
                      item.frameWidth = result.frameWidth;
                      item.framesPerSecond = _getFramesPerSecond(result, lastResults, false);
                  } else {
                      item = statistic.local.video;
                      item.frameHeight = result.frameHeight;
                      item.frameWidth = result.frameWidth;
                      item.framesPerSecond = _getFramesPerSecond(result, lastResults, true);  
                  }
              }
          });
          successCallback(statistic, results);
      }, errorCallback);
  
      function _getBitratePerSecond(result, lastResults, isLocal) {
          var lastResult = lastResults && lastResults.get(result.id),
              seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
              kilo = 1024,
              bit = 8,
              bitrate;
  
          if (!lastResult) {
              bitrate = 0;
          } else if (isLocal) {
              bitrate = bit * (result.bytesSent - lastResult.bytesSent) / (kilo * seconds);
          } else {
              bitrate = bit * (result.bytesReceived - lastResult.bytesReceived) / (kilo * seconds);
          }
  
          return Math.round(bitrate);
      }
  
      function _getFramesPerSecond(result, lastResults, isLocal) {
          var lastResult = lastResults && lastResults.get(result.id),
              seconds = lastResult ? ((result.timestamp - lastResult.timestamp) / 1000) : 5,
              framesPerSecond;
  
          if (!lastResult) {
              framesPerSecond = 0;
          } else if (isLocal) {
              framesPerSecond = (result.framesSent - lastResult.framesSent) / seconds;
          } else {
              framesPerSecond = (result.framesReceived - lastResult.framesReceived) / seconds;
          }
  
          return Math.round(framesPerSecond * 10) / 10;
      }
  }