0

I am using Exoplayer2 and i have no callback when i override the onBandwidthSample method. What am i doing bad? This is my code:

        new DefaultBandwidthMeter(new Handler(), new BandwidthMeter.EventListener() {
            @Override
            public void onBandwidthSample(int elapsedMs, long bytes, long bitrate) {
                Log.i(TAG, "onBandwidthSample bitrateEstimate = " + bitrate);
                Log.i(TAG, "onBandwidthSample bytesDownloaded = " + bytes);
            }
        });
Billyjoker
  • 729
  • 1
  • 10
  • 31
  • You need to pass the bandwidth meter to the constructor of a datasource. Can you post that code? – marcbaechinger Jan 10 '18 at 21:16
  • i did it. I think the problem is that a instantiate in another point of my code (previous to this issue) DefaultBandwidthMeter with no handler, and the second one that i create has no effect. If i create just one DefaultBandwidthMeter with the handler and the EventListener, i get the callback – Billyjoker Jan 15 '18 at 16:38
  • Yes. When you are loading from one server only I'd use only one bandwidth meter. – marcbaechinger Jan 15 '18 at 16:40

0 Answers0