35 Commits

Author SHA1 Message Date
ibaker
d5f9cf4f19 Add singleVariant publishing config to all published gradle files
Docs:
* https://developer.android.com/build/publish-library/configure-pub-variants#single-pub-var
* https://developer.android.com/reference/tools/gradle-api/8.0/com/android/build/api/dsl/PublishingOptions

This resolves the following warning from Android Gradle Plugin 7.2.2 and
helps unblock the upgrade to AGP 8.0.1:

> Software Components will not be created automatically for Maven
> publishing from Android Gradle Plugin 8.0. To opt-in to the future
> behavior, set the Gradle property
> `android.disableAutomaticComponentCreation=true` in the
> `gradle.properties` file or use the new publishing DSL.
>
> Affected Modules: `lib-cast`, `lib-common`, `lib-container`,
> `lib-database`, `lib-datasource`, `lib-datasource-cronet`,
> `lib-datasource-okhttp`, `lib-datasource-rtmp`, `lib-decoder`,
> `lib-effect`, `lib-exoplayer`, `lib-exoplayer-all (legacy)`,
> `lib-exoplayer-dash`, `lib-exoplayer-hls`, `lib-exoplayer-ima`,
> `lib-exoplayer-rtsp`, `lib-exoplayer-smoothstreaming`,
> `lib-exoplayer-workmanager`, `lib-extractor`, `lib-media2 (legacy)`,
> `lib-mediasession (legacy)`, `lib-muxer`, `lib-session`,
> `lib-transformer`, `lib-ui`, `lib-ui-leanback`, `test-utils`,
> `test-utils-robolectric`

Issue: androidx/media#409
PiperOrigin-RevId: 533464133
2023-05-19 17:22:21 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
rohks
b120ef65ed Remove two deprecated InvalidResponseCodeException constructors
Use a non-deprecated constructor that accepts additional fields(`cause`, `responseBody`) to enhance error logging.

#minor-release

PiperOrigin-RevId: 532190896
2023-05-16 09:57:39 +01:00
ibaker
0a86790be2 Remove two deprecated SimpleCache constructors
Use a non-deprecated constructor that takes a `DatabaseProvider`
instead for better performance.

#minor-release

PiperOrigin-RevId: 532046598
2023-05-16 09:41:12 +01:00
ibaker
b4b7e0e7c0 Add DataSource contract test checking scheme case insensitivity
Systems accepting URIs should treat schemes as case-insensitive
([RFC 3986 Section 3.1](https://www.rfc-editor.org/rfc/rfc3986#section-3.1)):
>  An implementation should accept uppercase letters as equivalent to
>  lowercase in scheme names (e.g., allow "HTTP" as well as "http") for
>  the sake of robustness

PiperOrigin-RevId: 528735287
2023-05-03 17:10:47 +01:00
tonihei
889f435a49 Update dependencies to latest versions
The only dependencies that are not updated are the ones that need
to be kept in sync with other system (like Android source tree) or
would require a Kotlin dependency in common or exoplayer modules.

As a side effect, some demo apps now need a Kotlin config and some
additional modules require desugaring/multidex logic. To simplify
the setup, the desugaring and multidex steps are added to the common
config.

PiperOrigin-RevId: 527243950
2023-04-26 15:49:57 +01:00
rohks
6a928805d4 Fix javadoc links in media README files
Also fixed the javadoc link in devsite and removed javadoc links from decoder extensions as it is not published yet on developer.android.com.

#minor-release

PiperOrigin-RevId: 520636868
2023-03-30 17:26:40 +00:00
tonihei
6952771e2f Remove remaining references to exoplayer.dev
PiperOrigin-RevId: 520314781
2023-03-30 17:20:36 +00:00
ibaker
cb7d565fd4 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

#minor-release

PiperOrigin-RevId: 513873453
2023-03-07 11:49:24 +00:00
tofunmi
198d73425e Create DataSourceBitmapLoader
PiperOrigin-RevId: 512659747
2023-03-01 17:19:13 +00:00
christosts
1249dcdc47 Merge pull request #10959 from balachandarlinks:handle-sql-exception-in-cached-content-index
PiperOrigin-RevId: 508323432
2023-02-14 14:24:36 +00:00
ibaker
636a4a8538 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
2022-12-12 11:19:23 +00:00
ibaker
3efc62b512 Deprecate C.POSITION_UNSET in favour of C.INDEX_UNSET
These have the same value (`-1`), and basically the same meaning (offset
in an array/list/file/byte stream/etc), but 'position' is an overloaded
term in a media playback library, and there's a risk people assume that
methods like `Player.getCurrentPosition()` may return
`C.POSITION_UNSET`, when in fact unset media times (whether duration or
position) are always represented by `C.TIME_UNSET` which is a) a `long`
(not `int`) and b) a different underlying value. (aside:
`getCurrentPosition()` never returns an unset value, but it's a good
example of the ambiguity of the word 'position' between 'byte offset'
and 'media timestamp'.)

PiperOrigin-RevId: 492493102
2022-12-12 11:09:18 +00:00
rohks
c96e010d35 Fix instrumentation tests not working via Gradle
PiperOrigin-RevId: 475560401
2022-09-30 18:03:11 +00:00
rohks
5b3f320230 Switch incorrectly configured native multidex to legacy
Native multidex can only be used for binaries with minSdkVersion of 21 or higher, but minSdkVersion was specified to 16.

PiperOrigin-RevId: 470003836
2022-09-30 17:04:29 +00:00
ibaker
2deb435625 Annotate methods that always return this with @CanIgnoreReturnValue
It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
2022-08-08 07:55:25 +00:00
ibaker
ac300c4a00 Add @code tags to DefaultDataSource javadoc
#minor-release

PiperOrigin-RevId: 461902089
2022-07-21 12:52:19 +00:00
ibaker
cb04297420 Remove InvalidResponseCodeException#headerFields from the stable API
Representing HTTP headers in a `java.util.Map` is error-prone, because
the names (keys) need to be case-insensitive (per
[RFC 2616 section 4.2](https://datatracker.ietf.org/doc/html/rfc2616#section-4.2))
but this is fundamentally technically incompatible with the `Map`
interface (e.g. with headers `{"key": ["val_1", "val_2"]}` then
`get("key")` and `get("KeY")` both return the same list, but `size()`
returns `1`). It also breaks as soon as you copy the `Map` into a
non-case-insensitive (i.e. normal) `Map` implementation, e.g. Guava's
`ImmutableMap`. It's risky that a line as 'innocent' as
`ImmutableMap.copyOf(headers)` could break things so badly.

For now it's enough to keep this field unstable (it's currently the only
reference to HTTP headers in the stable API). We can consider
stabilising an improved HTTP header representation in future.

PiperOrigin-RevId: 450708598
2022-05-26 11:51:27 +00:00
aquilescanta
e008a78ea6 Disable transcoding when reading content URIs
Before this change, we list the formats for which we don't
want transcoding. This change disables transcoding altogether.

This was tested by checking that transcoding takes place on a
short camera recording only when the added flag is not present
(and AndroidManifest does not declare support for HEVC).

PiperOrigin-RevId: 446986580
2022-05-09 11:04:52 +01:00
ibaker
89c4bbec5b Stabilise HttpDataSource and its nested exceptions
PiperOrigin-RevId: 438558981
2022-04-06 11:36:53 +01:00
hschlueter
81ab6c730d Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-06 11:28:30 +01:00
ibaker
be4cbb886b Stabilise DefaultDataSource.Factory, including 2 constructors
This allows apps to customise the HTTP DataSource while still supporting
non-HTTP URIs as well, as documented in our dev guide:
https://exoplayer.dev/network-stacks.html#configuring-exoplayer-to-use-a-specific-network-stack

PiperOrigin-RevId: 437209880
2022-03-25 14:06:58 +00:00
ibaker
fe8996e634 Allow stable API users to customise the DataSource used
Also stabilise the 3 HTTP-based DataSource implementations:
* DefaultHttpDataSource
* OkHttpDataSource
* CronetDataSource

PiperOrigin-RevId: 436690643
2022-03-23 10:05:27 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
tonihei
287182952d Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 11:07:50 +00:00
olly
1f7174e731 Revert of 87420e5f9bd1671cd3068185f7358f5faba53e71
PiperOrigin-RevId: 426996878
2022-02-08 11:07:43 +00:00
ibaker
87420e5f9b Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 10:49:31 +00:00
ibaker
2522815d7b Add TYPE_USE to 'frequently used' IntDefs in a backwards-compatible way
This ensures Kotlin usages of these IntDef annotations in the 'old'
position will continue to compile.

'Frequently used' is a subjective judgement. I have a parallel change
that marks all the other public IntDefs in the library as TYPE_USE
(those that I've judged to be 'rarely used' by apps).

A follow-up change will fix the positions of existing usages to be as if
they're only TYPE_USE.

#minor-release

PiperOrigin-RevId: 426427334
2022-02-07 10:48:39 +00:00
ibaker
01c814e2f0 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 10:47:50 +00:00
ibaker
a4f67ccf6a Change DefaultHttpDataSourceTest to an instrumentation test
The Robolectric implementation of HttpURLConnection forwards to the JRE
implementation [1], which behaves differently to the Android one
available on devices and emulators. For these tests to be a realistic
test of the HTTP stack used in real playbacks we can't use Robolectric.

Similar to d1e12dcddf

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 416013662
2022-01-05 10:00:46 +00:00
ibaker
191185096c Remove null keys from DefaultHttpDataSource#getResponseHeaders
PiperOrigin-RevId: 410507648
2021-11-19 14:56:43 +00:00
ibaker
ded68ed981 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-19 14:33:46 +00:00
ibaker
d1e12dcddf Make DefaultHttpDataSourceContractTest an instrumentation test
Robolectric uses the JRE HttpURLConnection [1], while real Android
devices and emulators use OkHttp to implement HttpURLConnection. This
can lead to important differences in behaviour, so it's better to use
instrumentation tests when specific HTTP behaviour is important.

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 408840295
2021-11-19 14:32:49 +00:00
bachinger
222db48298 Make package in test manifest consistent
PiperOrigin-RevId: 406255369
2021-11-08 15:18:26 +00:00
Andrew Lewis
933e207b3e Update to androidx.media3
PiperOrigin-RevId: 405656499
2021-10-27 09:12:46 +01:00