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
bff7ac0d
authored
Sep 11, 2020
by
olly
Committed by
Oliver Woodman
Sep 11, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up some lint warnings
PiperOrigin-RevId: 331162350
parent
99cdf2ca
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
51 deletions
demos/cast/build.gradle
demos/main/build.gradle
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
demos/main/src/main/res/values/strings.xml
extensions/media2/build.gradle
extensions/workmanager/build.gradle
demos/cast/build.gradle
View file @
bff7ac0d
...
@@ -60,7 +60,7 @@ dependencies {
...
@@ -60,7 +60,7 @@ dependencies {
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'androidx.multidex:multidex:'
+
androidxMultidexVersion
implementation
'androidx.multidex:multidex:'
+
androidxMultidexVersion
implementation
'androidx.recyclerview:recyclerview:1.1.0'
implementation
'androidx.recyclerview:recyclerview:1.1.0'
implementation
'com.google.android.material:material:1.
1.0
'
implementation
'com.google.android.material:material:1.
2.1
'
}
}
apply
plugin:
'com.google.android.gms.strict-version-matcher-plugin'
apply
plugin:
'com.google.android.gms.strict-version-matcher-plugin'
demos/main/build.gradle
View file @
bff7ac0d
...
@@ -69,7 +69,7 @@ dependencies {
...
@@ -69,7 +69,7 @@ dependencies {
implementation
'androidx.annotation:annotation:'
+
androidxAnnotationVersion
implementation
'androidx.annotation:annotation:'
+
androidxAnnotationVersion
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'androidx.multidex:multidex:'
+
androidxMultidexVersion
implementation
'androidx.multidex:multidex:'
+
androidxMultidexVersion
implementation
'com.google.android.material:material:1.2.
0
'
implementation
'com.google.android.material:material:1.2.
1
'
implementation
(
'com.google.guava:guava:'
+
guavaVersion
)
{
implementation
(
'com.google.guava:guava:'
+
guavaVersion
)
{
exclude
group:
'com.google.code.findbugs'
,
module:
'jsr305'
exclude
group:
'com.google.code.findbugs'
,
module:
'jsr305'
exclude
group:
'org.checkerframework'
,
module:
'checker-compat-qual'
exclude
group:
'org.checkerframework'
,
module:
'checker-compat-qual'
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
bff7ac0d
...
@@ -222,7 +222,11 @@ public class DownloadTracker {
...
@@ -222,7 +222,11 @@ public class DownloadTracker {
}
}
widevineOfflineLicenseFetchTask
=
widevineOfflineLicenseFetchTask
=
new
WidevineOfflineLicenseFetchTask
(
new
WidevineOfflineLicenseFetchTask
(
format
,
mediaItem
.
playbackProperties
.
drmConfiguration
.
licenseUri
,
this
,
helper
);
format
,
mediaItem
.
playbackProperties
.
drmConfiguration
.
licenseUri
,
httpDataSourceFactory
,
/* dialogHelper= */
this
,
helper
);
widevineOfflineLicenseFetchTask
.
execute
();
widevineOfflineLicenseFetchTask
.
execute
();
}
}
...
@@ -271,6 +275,32 @@ public class DownloadTracker {
...
@@ -271,6 +275,32 @@ public class DownloadTracker {
// Internal methods.
// Internal methods.
/**
* Returns the first {@link Format} with a non-null {@link Format#drmInitData} found in the
* content's tracks, or null if none is found.
*/
@Nullable
private
Format
getFirstFormatWithDrmInitData
(
DownloadHelper
helper
)
{
for
(
int
periodIndex
=
0
;
periodIndex
<
helper
.
getPeriodCount
();
periodIndex
++)
{
MappedTrackInfo
mappedTrackInfo
=
helper
.
getMappedTrackInfo
(
periodIndex
);
for
(
int
rendererIndex
=
0
;
rendererIndex
<
mappedTrackInfo
.
getRendererCount
();
rendererIndex
++)
{
TrackGroupArray
trackGroups
=
mappedTrackInfo
.
getTrackGroups
(
rendererIndex
);
for
(
int
trackGroupIndex
=
0
;
trackGroupIndex
<
trackGroups
.
length
;
trackGroupIndex
++)
{
TrackGroup
trackGroup
=
trackGroups
.
get
(
trackGroupIndex
);
for
(
int
formatIndex
=
0
;
formatIndex
<
trackGroup
.
length
;
formatIndex
++)
{
Format
format
=
trackGroup
.
getFormat
(
formatIndex
);
if
(
format
.
drmInitData
!=
null
)
{
return
format
;
}
}
}
}
}
return
null
;
}
private
void
onOfflineLicenseFetched
(
DownloadHelper
helper
,
byte
[]
keySetId
)
{
private
void
onOfflineLicenseFetched
(
DownloadHelper
helper
,
byte
[]
keySetId
)
{
this
.
keySetId
=
keySetId
;
this
.
keySetId
=
keySetId
;
onDownloadPrepared
(
helper
);
onDownloadPrepared
(
helper
);
...
@@ -309,6 +339,19 @@ public class DownloadTracker {
...
@@ -309,6 +339,19 @@ public class DownloadTracker {
trackSelectionDialog
.
show
(
fragmentManager
,
/* tag= */
null
);
trackSelectionDialog
.
show
(
fragmentManager
,
/* tag= */
null
);
}
}
/**
* Returns whether any the {@link DrmInitData.SchemeData} contained in {@code drmInitData} has
* non-null {@link DrmInitData.SchemeData#data}.
*/
private
boolean
hasSchemaData
(
DrmInitData
drmInitData
)
{
for
(
int
i
=
0
;
i
<
drmInitData
.
schemeDataCount
;
i
++)
{
if
(
drmInitData
.
get
(
i
).
hasData
())
{
return
true
;
}
}
return
false
;
}
private
void
startDownload
()
{
private
void
startDownload
()
{
startDownload
(
buildDownloadRequest
());
startDownload
(
buildDownloadRequest
());
}
}
...
@@ -327,9 +370,11 @@ public class DownloadTracker {
...
@@ -327,9 +370,11 @@ public class DownloadTracker {
/** Downloads a Widevine offline license in a background thread. */
/** Downloads a Widevine offline license in a background thread. */
@RequiresApi
(
18
)
@RequiresApi
(
18
)
private
final
class
WidevineOfflineLicenseFetchTask
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
static
final
class
WidevineOfflineLicenseFetchTask
extends
AsyncTask
<
Void
,
Void
,
Void
>
{
private
final
Format
format
;
private
final
Format
format
;
private
final
Uri
licenseUri
;
private
final
Uri
licenseUri
;
private
final
HttpDataSource
.
Factory
httpDataSourceFactory
;
private
final
StartDownloadDialogHelper
dialogHelper
;
private
final
StartDownloadDialogHelper
dialogHelper
;
private
final
DownloadHelper
downloadHelper
;
private
final
DownloadHelper
downloadHelper
;
...
@@ -339,10 +384,12 @@ public class DownloadTracker {
...
@@ -339,10 +384,12 @@ public class DownloadTracker {
public
WidevineOfflineLicenseFetchTask
(
public
WidevineOfflineLicenseFetchTask
(
Format
format
,
Format
format
,
Uri
licenseUri
,
Uri
licenseUri
,
HttpDataSource
.
Factory
httpDataSourceFactory
,
StartDownloadDialogHelper
dialogHelper
,
StartDownloadDialogHelper
dialogHelper
,
DownloadHelper
downloadHelper
)
{
DownloadHelper
downloadHelper
)
{
this
.
format
=
format
;
this
.
format
=
format
;
this
.
licenseUri
=
licenseUri
;
this
.
licenseUri
=
licenseUri
;
this
.
httpDataSourceFactory
=
httpDataSourceFactory
;
this
.
dialogHelper
=
dialogHelper
;
this
.
dialogHelper
=
dialogHelper
;
this
.
downloadHelper
=
downloadHelper
;
this
.
downloadHelper
=
downloadHelper
;
}
}
...
@@ -373,43 +420,4 @@ public class DownloadTracker {
...
@@ -373,43 +420,4 @@ public class DownloadTracker {
}
}
}
}
}
}
/**
* Returns whether any the {@link DrmInitData.SchemeData} contained in {@code drmInitData} has
* non-null {@link DrmInitData.SchemeData#data}.
*/
private
static
boolean
hasSchemaData
(
DrmInitData
drmInitData
)
{
for
(
int
i
=
0
;
i
<
drmInitData
.
schemeDataCount
;
i
++)
{
if
(
drmInitData
.
get
(
i
).
hasData
())
{
return
true
;
}
}
return
false
;
}
/**
* Returns the first {@link Format} with a non-null {@link Format#drmInitData} found in the
* content's tracks, or null if none is found.
*/
@Nullable
private
Format
getFirstFormatWithDrmInitData
(
DownloadHelper
helper
)
{
for
(
int
periodIndex
=
0
;
periodIndex
<
helper
.
getPeriodCount
();
periodIndex
++)
{
MappedTrackInfo
mappedTrackInfo
=
helper
.
getMappedTrackInfo
(
periodIndex
);
for
(
int
rendererIndex
=
0
;
rendererIndex
<
mappedTrackInfo
.
getRendererCount
();
rendererIndex
++)
{
TrackGroupArray
trackGroups
=
mappedTrackInfo
.
getTrackGroups
(
rendererIndex
);
for
(
int
trackGroupIndex
=
0
;
trackGroupIndex
<
trackGroups
.
length
;
trackGroupIndex
++)
{
TrackGroup
trackGroup
=
trackGroups
.
get
(
trackGroupIndex
);
for
(
int
formatIndex
=
0
;
formatIndex
<
trackGroup
.
length
;
formatIndex
++)
{
Format
format
=
trackGroup
.
getFormat
(
formatIndex
);
if
(
format
.
drmInitData
!=
null
)
{
return
format
;
}
}
}
}
}
return
null
;
}
}
}
demos/main/src/main/res/values/strings.xml
View file @
bff7ac0d
...
@@ -25,16 +25,10 @@
...
@@ -25,16 +25,10 @@
<string
name=
"error_generic"
>
Playback failed
</string>
<string
name=
"error_generic"
>
Playback failed
</string>
<string
name=
"error_unrecognized_abr_algorithm"
>
Unrecognized ABR algorithm
</string>
<string
name=
"error_unrecognized_stereo_mode"
>
Unrecognized stereo mode
</string>
<string
name=
"error_drm_unsupported_before_api_18"
>
DRM content not supported on API levels below 18
</string>
<string
name=
"error_drm_unsupported_before_api_18"
>
DRM content not supported on API levels below 18
</string>
<string
name=
"error_drm_unsupported_scheme"
>
This device does not support the required DRM scheme
</string>
<string
name=
"error_drm_unsupported_scheme"
>
This device does not support the required DRM scheme
</string>
<string
name=
"error_drm_unknown"
>
An unknown DRM error occurred
</string>
<string
name=
"error_no_decoder"
>
This device does not provide a decoder for
<xliff:g
id=
"mime_type"
>
%1$s
</xliff:g></string>
<string
name=
"error_no_decoder"
>
This device does not provide a decoder for
<xliff:g
id=
"mime_type"
>
%1$s
</xliff:g></string>
<string
name=
"error_no_secure_decoder"
>
This device does not provide a secure decoder for
<xliff:g
id=
"mime_type"
>
%1$s
</xliff:g></string>
<string
name=
"error_no_secure_decoder"
>
This device does not provide a secure decoder for
<xliff:g
id=
"mime_type"
>
%1$s
</xliff:g></string>
...
...
extensions/media2/build.gradle
View file @
bff7ac0d
...
@@ -18,7 +18,7 @@ android.defaultConfig.minSdkVersion 19
...
@@ -18,7 +18,7 @@ android.defaultConfig.minSdkVersion 19
dependencies
{
dependencies
{
implementation
project
(
modulePrefix
+
'library-core'
)
implementation
project
(
modulePrefix
+
'library-core'
)
implementation
'androidx.collection:collection:'
+
androidxCollectionVersion
implementation
'androidx.collection:collection:'
+
androidxCollectionVersion
implementation
'androidx.concurrent:concurrent-futures:1.
0
.0'
implementation
'androidx.concurrent:concurrent-futures:1.
1
.0'
implementation
(
'com.google.guava:guava:'
+
guavaVersion
)
{
implementation
(
'com.google.guava:guava:'
+
guavaVersion
)
{
exclude
group:
'com.google.code.findbugs'
,
module:
'jsr305'
exclude
group:
'com.google.code.findbugs'
,
module:
'jsr305'
exclude
group:
'org.checkerframework'
,
module:
'checker-compat-qual'
exclude
group:
'org.checkerframework'
,
module:
'checker-compat-qual'
...
...
extensions/workmanager/build.gradle
View file @
bff7ac0d
...
@@ -17,7 +17,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
...
@@ -17,7 +17,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
dependencies
{
dependencies
{
implementation
project
(
modulePrefix
+
'library-core'
)
implementation
project
(
modulePrefix
+
'library-core'
)
implementation
'androidx.work:work-runtime:2.
3.4
'
implementation
'androidx.work:work-runtime:2.
4.0
'
// Guava & Gradle interact badly, and this prevents
// Guava & Gradle interact badly, and this prevents
// "cannot access ListenableFuture" errors [internal b/157225611].
// "cannot access ListenableFuture" errors [internal b/157225611].
// More info: https://blog.gradle.org/guava
// More info: https://blog.gradle.org/guava
...
...
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