Re: How to use stats

I would think we would have to set type based on the most specific type.


On Thu, Feb 7, 2013 at 8:56 AM, Martin Thomson <martin.thomson@gmail.com>wrote:

> Given the API that we decided to go with, here is code that will
> produce one line (to console) for each RTP stream that includes a
> timestamp and the ssrc for those streams.
>
> function statsCallback(allStats) {
>   var stats = getStatsByType(allStats, 'RTPStreamStats');
>   stats.forEach(function(v) {
>     console.log(v.timestamp + ' ' + v.id + ' ' + v.ssrc);
>   });
> }
>
> function getStatsByType(allStats, type) {
>   return Object.keys(allStats).filter(function(id) {
>     return allStats[id].type === allStats;
>   }).map(function(id) {
>     return allStats[id];
>   });
> }
>
> Question: do we set type for an RTCStatsObject based on the most
> specific type?  That would invalidate the filtering I'm doing here.
>
>

Received on Thursday, 7 February 2013 17:09:27 UTC