Skip to content

Add Downloader analytics listeners (e.g., onLoadCompleted / onLoadError) #7652

@beazlr02

Description

@beazlr02

As many other people we are often the victim of misconfigured CDNs, overloaded CDNs or problems with origin. Its for this reason we like to track when segments fail (or even manifest) to download and include information such as response headers, status codes, uris. This is possible for an online streaming session (MediaSourceEventListener / AnalyticsListener) but not during download for an offline playback session.

Proposed solution

Add:
com.google.android.exoplayer2.offline.DownloadManager#addDownloadAnalyticsListener

public interface DownloadAnalyticsListener {

   default void onLoadError(DownloadManager downloadManager, Download download, int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData, IOException error, boolean wasCanceled) {   }

   default void onLoadStarted(DownloadManager downloadManager, Download download, int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData) {  }

   default void onLoadCompleted(DownloadManager downloadManager, Download download, int windowIndex, MediaSource.MediaPeriodId mediaPeriodId, MediaSourceEventListener.LoadEventInfo loadEventInfo, MediaSourceEventListener.MediaLoadData mediaLoadData) { }

}

Alternatives considered

We have considered using an OKHttpDatasourceFactory with TransferListener to mitigate this need.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions