From d6d7c41065df08e174eccbe650e4b73e5be96d8a Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 10 May 2018 14:11:36 -0700 Subject: [PATCH] Expose manifests/playlists from download helpers This is useful to get hold of the manifest to then obtain DRM init data in the download flow for protected content (without having to download the manifest again). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=196168938 --- .../exoplayer2/source/dash/offline/DashDownloadHelper.java | 6 ++++++ .../exoplayer2/source/hls/offline/HlsDownloadHelper.java | 6 ++++++ .../source/smoothstreaming/offline/SsDownloadHelper.java | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadHelper.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadHelper.java index 8a6069e477..bd19ff6587 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadHelper.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadHelper.java @@ -56,6 +56,12 @@ public final class DashDownloadHelper extends DownloadHelper { manifestDataSourceFactory.createDataSource(), new DashManifestParser(), uri); } + /** Returns the DASH manifest. Must not be called until after preparation completes. */ + public DashManifest getManifest() { + Assertions.checkNotNull(manifest); + return manifest; + } + @Override public int getPeriodCount() { Assertions.checkNotNull(manifest); diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadHelper.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadHelper.java index 773aec49ee..37aa181970 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadHelper.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadHelper.java @@ -57,6 +57,12 @@ public final class HlsDownloadHelper extends DownloadHelper { playlist = ParsingLoadable.load(dataSource, new HlsPlaylistParser(), uri); } + /** Returns the HLS playlist. Must not be called until after preparation completes. */ + public HlsPlaylist getPlaylist() { + Assertions.checkNotNull(playlist); + return playlist; + } + @Override public int getPeriodCount() { Assertions.checkNotNull(playlist); diff --git a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloadHelper.java b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloadHelper.java index 82464101d6..e60be93c93 100644 --- a/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloadHelper.java +++ b/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/offline/SsDownloadHelper.java @@ -52,6 +52,12 @@ public final class SsDownloadHelper extends DownloadHelper { manifest = ParsingLoadable.load(dataSource, new SsManifestParser(), uri); } + /** Returns the SmoothStreaming manifest. Must not be called until after preparation completes. */ + public SsManifest getManifest() { + Assertions.checkNotNull(manifest); + return manifest; + } + @Override public int getPeriodCount() { Assertions.checkNotNull(manifest);