124 Commits

Author SHA1 Message Date
andrewlewis
74c493f51e Add back support for setting audio pitch
To play slow motion streams where the audio has been recorded at
slower speeds, it is necessary to be able to resample (rather than
time-stretch) the audio. This change undeprecates back the previously
deprecated PlaybackParameters class to allow apps to set pitch.

PiperOrigin-RevId: 328703116
2020-08-27 12:06:41 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00
olly
63ae4cc54b Rollback of 6ae472243f
*** Original commit ***

Rename Util methods to clarify which Looper is used.

The method name didn't clarify that either the main or current
Looper is used.

***

PiperOrigin-RevId: 317283606
2020-06-23 11:05:56 +01:00
tonihei
6ae472243f Rename Util methods to clarify which Looper is used.
The method name didn't clarify that either the main or current
Looper is used.

PiperOrigin-RevId: 317276561
2020-06-23 11:05:46 +01:00
Dennis Fölster
8d2406ece3 Keep the paused state during buffering without playWhenReady.
The PlaybackStateCompat#STATE_BUFFERING expects the playback to begin
once enough data has been buffered. This is however not the case if
playWhenReady is not set on the exoplayer.
2020-05-12 14:43:47 +02:00
bachinger
1699ab0d18 Add missing nullable annotations
The MediaSessionConnector gets a Bundle passed to the MediaSession.Callback
from the framework which can be null. This needs to be properly annotated
with @Nullable.

Issue: #7234
PiperOrigin-RevId: 307822764
2020-04-27 10:40:01 +01:00
bachinger
527563da31 remove deprecated usage of PlaybackParameter
Removes usage of PlaybackParameters where it seems to be trivial.

PiperOrigin-RevId: 300435199
2020-03-19 00:45:18 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
bachinger
68398b708e remove pitch field from PlaybackParameters
PiperOrigin-RevId: 294936851
2020-02-17 17:12:19 +00:00
bachinger
016bacd178 remove deprecated usage of onPlayerStateChanged
PiperOrigin-RevId: 294181886
2020-02-11 17:10:56 +00:00
bachinger
c02933ac0a rename getPlaybackError
PiperOrigin-RevId: 294074348
2020-02-11 17:10:41 +00:00
bachinger
e1c48515eb add next, previous, fastForward and rewind to ControlDispatcher
Issue: #6926, #6934
PiperOrigin-RevId: 293315532
2020-02-11 17:07:52 +00:00
bachinger
2adec8d984 annotate nullabilty of CommandReceiver
Issue: #6938
PiperOrigin-RevId: 292415853
2020-01-31 17:52:08 +00:00
ibaker
4c4cabdfac (partial) Rollback of 880b879e8c
*** Original commit ***

Suppress warnings emitted by Checker Framework version 2.11.1

More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

Tested:
    TAP train for global presubmit queue
    http://test/OCL:278152710:BASE:278144052:1572760370662:22459c12

***

PiperOrigin-RevId: 284738438
2019-12-10 12:37:26 +00:00
bachinger
6c10c94f94 MediaSessionConnector: Support ACTION_SET_CAPTIONING_ENABLED
PiperOrigin-RevId: 283546707
2019-12-04 10:00:04 +00:00
bachinger
734b4ad9c8 document media button handling prior to API level 21
ISSUE: #6545
PiperOrigin-RevId: 281032120
2019-11-18 17:54:07 +00:00
olly
46d58b5eda Add missing IntDef case in switch
PiperOrigin-RevId: 278332276
2019-11-05 16:17:54 +00:00
olly
880b879e8c Suppress warnings emitted by Checker Framework version 2.11.1
More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

Tested:
    TAP train for global presubmit queue
    http://test/OCL:278152710:BASE:278144052:1572760370662:22459c12
PiperOrigin-RevId: 278241536
2019-11-05 16:17:39 +00:00
olly
c5c50078d7 Reset MediaSession shuffle/repeat modes if player is null
- This is for consistency with PlayerControlView.

- Also update PlayerNotificationManager notification if shuffle
  mode changes. This is for consistency with what happens when
  the repeat mode changes. By default the notification will be
  unchanged, but custom implementations can extend and then
  override createNotification, and given these modes change
  infrequently it feels like we can just do this. The alternative
  for achieving consistency would be to remove handling of repeat
  mode changes.

Issue: #6582
PiperOrigin-RevId: 277925094
2019-11-05 16:16:45 +00:00
aquilescanta
0f312561e5 Add shuffle and repeat modes to media session playback state invalidation
Which ensures both get updated when the MediaSessionConnector player
changes.

Issue:#6582
PiperOrigin-RevId: 277254889
2019-10-30 08:51:35 +00:00
ibaker
7277df3547 Remove @NonNull where it's implied by @NonNullApi
Also remove it from all tests, these aren't covered by the null-checker

Covered by the following package-info.java files:
- j/c/g/a/exoplayer2/ext/mediasession/package-info.java
- j/c/g/a/exoplayer2/package-info.java
- j/c/g/a/exoplayer2/offline/package-info.java
- j/c/g/a/exoplayer2/video/package-info.java
- j/c/g/a/exoplayer2/ui/package-info.java

PiperOrigin-RevId: 277038916
2019-10-30 08:50:42 +00:00
olly
efe6e6408a Cleanup: Only clamp seek positions for FFWD/RWND
It's confusing that seekTo(player, windowIndex, positionMs) does
clamping, because it only makes sense if windowIndex is the current
window.

Note: This doesn't actually fix anything (other than code clarity).
In cases where we were passing other windowIndices, we always
passed 0 as the position and so the clamping logic wouldn't have
had any effect.
PiperOrigin-RevId: 272857104
2019-10-04 13:33:09 +01:00
olly
7fff1dfd9c Remove stray line of code (it's duplicated below)
PiperOrigin-RevId: 270289374
2019-09-20 17:49:03 +01:00
tonihei
c5ceefd609 Fix playback speed in MediaSessionConnector
The playback speed set in MediaSession's PlaybackStateCompat needs to be the
actual speed at which the playback position progresses and not the user-defined
target speed.

This fixed a bug where the position advances although the player lost audio
focus.

Issue:#6203
PiperOrigin-RevId: 269295249
2019-09-16 23:31:41 +01:00
bachinger
f08258e48d disable seekbar in media style notification for live stream
ISSUE: #6416
PiperOrigin-RevId: 268673895
2019-09-13 13:51:04 +01:00
olly
0dc997103b Use constant to define androidx media version
PiperOrigin-RevId: 266802551
2019-09-05 10:45:24 +01:00
olly
a02237de20 Fix imports
PiperOrigin-RevId: 266676413
2019-09-01 22:03:52 +01:00
tonihei
b0330edc0b Fix some Android Studio nullness warning created by new @NonNullApi.
PiperOrigin-RevId: 261888086
2019-08-06 15:53:52 +01:00
tonihei
6f2e24915d Add @NonNullApi and annotate two packages with it.
This new annotation declares everything as non-null by default and can be
used as a package annotation in package-info.java.

In this change the core lib offline package and the mediasession extension is
annotated that way as initial example usage.

PiperOrigin-RevId: 260894548
2019-08-01 20:35:06 +01:00
bachinger
49a2e5a5cb add manifest to Timeline.Window
- Remove manifest argument from callbacks of Player.EventListener and
  SourceInfoRefreshListener. Instead make it accessible through
  Player.getCurrentManifest() and Timeline.Window.manifest.
- Fix all MediaSource implementation to include the manifest in the
  Timeline instead of passing it to the SourceInfoRefreshListener.
- Refactor ExoPlayerTestRunner, FakeTimeline, FakeMediaSource to
  reflect these changes and make tests pass.

PiperOrigin-RevId: 257359662
2019-07-14 16:20:45 +01:00
bachinger
259bea1652 MediaSessionConnector: Document how to provide metadata asynchronously
Issue: #6047
PiperOrigin-RevId: 255992898
2019-07-02 17:48:41 +01:00
bachinger
ae0aeb046b call setPlayWhenReady in any case
ISSUE: #6093
PiperOrigin-RevId: 255471282
2019-07-02 17:47:07 +01:00
olly
f74d2294be Remove media-session extension nullness blacklist
PiperOrigin-RevId: 249431620
2019-05-23 13:29:19 +01:00
bachinger
128ded5ba0 add playWhenReady to prepareXyz methods of PlaybackPreparer.
Issue: #5891
PiperOrigin-RevId: 248541827
2019-05-20 15:13:17 +01:00
bachinger
59b2dd2701 don't call stop before preparing the player
Issue: #5891
PiperOrigin-RevId: 248369509
2019-05-15 20:14:18 +01:00
tonihei
c480818249 Fix some random AndroidStudio warnings.
PiperOrigin-RevId: 245956915
2019-04-30 22:08:07 +01:00
tonihei
0bb32a8f09 Add IntDef for Player states.
PiperOrigin-RevId: 245925254
2019-04-30 22:07:47 +01:00
bachinger
44ad47746a Never set null as a session meta data object.
Issue: #5810
PiperOrigin-RevId: 245745646
2019-04-30 22:06:30 +01:00
andrewlewis
b01075f325 Play out remaining data on reconfiguration
Before this change we'd release the audio track and create a new one as soon
as audio processors had drained when reconfiguring.

Fix this behavior by stop()ing the AudioTrack to play out all written data.

Issue: #2446
PiperOrigin-RevId: 244812402
2019-04-26 18:27:53 +01:00
olly
bab7b9e9a1 Fix lint warnings for 2.10
PiperOrigin-RevId: 244268855
2019-04-18 23:24:49 +01:00
borrelli
0be4bee25f Add "setCustomErrorMessage" override that allows including an extras bundle with a custom error.
PiperOrigin-RevId: 243807109
2019-04-16 16:41:49 +01:00
borrelli
9fc3ea79a1 Add ability to register/unregister custom CommandReceivers.
PiperOrigin-RevId: 243799572
2019-04-16 15:28:57 +01:00
tonihei
1ee51518ae Use new exoplayer.dev domain everywhere.
The old domain automatically forwards to the new one. For consistency, change
all doc and code references regardless.

Also adds GitHub CNAME config file which configures our page for the custom
domain.

PiperOrigin-RevId: 243592110
2019-04-16 15:25:27 +01:00
bachinger
e8077fb3f4 honour shuffle order when publishing queue to media session
Issue #5360

PiperOrigin-RevId: 235196177
2019-03-06 16:54:26 +00:00
bachinger
44e23fabe6 let apps intercept/handle media button events by using a MediaButtonEventHandler
Issue #5179

PiperOrigin-RevId: 234571837
2019-02-19 13:23:19 +00:00
olly
0622afe170 Migrate to androidx
Issue: #5489
PiperOrigin-RevId: 234507428

Add missing annotation dependency

Issue: #5489
PiperOrigin-RevId: 234566177
2019-02-19 13:22:54 +00:00
bachinger
f9f55ae4d5 improve documentation on how to update queue when asynchronously loading media item assets
Issue #5494

PiperOrigin-RevId: 234138162
2019-02-18 17:40:48 +00:00
tonihei
edabbd52d0 Update Robolectric and Truth.
PiperOrigin-RevId: 233612344
2019-02-18 15:59:32 +00:00