Watching Exoplayer with Flipper

Now I’m using Flipper for network monitoring. Also my app works with video: user can watch online HLS video, and download video to device and watch offline. Will be nice if we can monitor Exoplayer networking too.

Exoplayer uses special interface for HTTP requests : HttpDataSource.Factory. And default implementation is class:

DefaultHttpDataSourceFactory(String userAgent, @Nullable TransferListener listener)

We can provide TransferListener object and Exoplayer will notify us about HTTP requests processing. To report HTTP data to Flipper we use NetworkFlipperPlugin instance. My implementation of TransferListener:

This implementation reports only HTTP status and headers without body. For me it’s ok, I don’t need binary data. Then I provide HttpDataSource factory with Dagger to all my media sources:

After that, I can see every chunk loaded by Exoplayer for online watching, precaching or downloading.

Sample of response of TS data.

--

--