Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3382c744
authored
Apr 26, 2019
by
eguven
Committed by
Oliver Woodman
Apr 26, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow content id to be set in DownloadHelper.getDownloadRequest
PiperOrigin-RevId: 245388082
parent
708cad6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java
View file @
3382c744
...
...
@@ -591,16 +591,27 @@ public final class DownloadHelper {
/**
* Builds a {@link DownloadRequest} for downloading the selected tracks. Must not be called until
* after preparation completes.
* after preparation completes.
The uri of the {@link DownloadRequest} will be used as content id.
*
* @param data Application provided data to store in {@link DownloadRequest#data}.
* @return The built {@link DownloadRequest}.
*/
public
DownloadRequest
getDownloadRequest
(
@Nullable
byte
[]
data
)
{
String
downloadId
=
uri
.
toString
();
return
getDownloadRequest
(
uri
.
toString
(),
data
);
}
/**
* Builds a {@link DownloadRequest} for downloading the selected tracks. Must not be called until
* after preparation completes.
*
* @param id The unique content id.
* @param data Application provided data to store in {@link DownloadRequest#data}.
* @return The built {@link DownloadRequest}.
*/
public
DownloadRequest
getDownloadRequest
(
String
id
,
@Nullable
byte
[]
data
)
{
if
(
mediaSource
==
null
)
{
return
new
DownloadRequest
(
downloadI
d
,
downloadType
,
uri
,
/* streamKeys= */
Collections
.
emptyList
(),
cacheKey
,
data
);
i
d
,
downloadType
,
uri
,
/* streamKeys= */
Collections
.
emptyList
(),
cacheKey
,
data
);
}
assertPreparedWithMedia
();
List
<
StreamKey
>
streamKeys
=
new
ArrayList
<>();
...
...
@@ -614,7 +625,7 @@ public final class DownloadHelper {
}
streamKeys
.
addAll
(
mediaPreparer
.
mediaPeriods
[
periodIndex
].
getStreamKeys
(
allSelections
));
}
return
new
DownloadRequest
(
downloadI
d
,
downloadType
,
uri
,
streamKeys
,
cacheKey
,
data
);
return
new
DownloadRequest
(
i
d
,
downloadType
,
uri
,
streamKeys
,
cacheKey
,
data
);
}
// Initialization of array of Lists.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment