453 Commits

Author SHA1 Message Date
krocard
3f4f2f90b5 Move offload events to their own listener
Move offload events from Player.EventListener to
ExoPlayer.AudioOffloadListener.

PiperOrigin-RevId: 362472462
2021-03-12 10:44:50 +00:00
olly
b563b82787 Add HttpUtil for tasks common to HttpDataSource implementations
Part of aligning HttpDataSource behavior will require adding
logic that's common across the DataSource implementations. This
change establishes a util class to house it, and moves a bit of
existing logic that's related and can be easily shared into it.

There is one small behavior change in this CL, which is that our
handling of Content-Range response headers can now parse the body
length if the "document size" part of the Content-Range is unknown,
for example "bytes 5-9/*". Previously the pattern we were matching
to required the "size" part to be set, for example "bytes 5-9/100",
despite the fact we don't need or use it.

PiperOrigin-RevId: 362396976
2021-03-12 10:44:40 +00:00
olly
1a68f3d3a4 Document DataSource edge-case behaviors
PiperOrigin-RevId: 362386100
2021-03-12 10:44:19 +00:00
kimvde
9d2d334091 Add available commands to prepare/play/pause/stop/release.
PiperOrigin-RevId: 362292208
2021-03-12 10:43:48 +00:00
krocard
baf1516ae4 Flatten listener using existing listeners
Adds a new Listener that extends all other listener.
This is part of the component flattening goal.

After components have been flattened in Player,
and clients transitioned, existing listeners will be deprecated.

PiperOrigin-RevId: 362287507
2021-03-12 10:43:26 +00:00
kimvde
0c9b02bf44 Make commands to seek unavailable during ads
ExoPlayer does not support seeking during ads.

PiperOrigin-RevId: 362274785
2021-03-12 10:43:05 +00:00
gyumin
27477a1980 Add MediaMetadata.EMPTY
PiperOrigin-RevId: 362186928
2021-03-12 10:42:44 +00:00
kimvde
4a6859e5e2 Replace MutableFlags by immutable class
PiperOrigin-RevId: 362043183
2021-03-12 10:42:02 +00:00
kimvde
851c915e38 Add COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM to available commands
PiperOrigin-RevId: 362036291
2021-03-12 10:41:51 +00:00
gyumin
a60ed20f1b Implement Bundleable for Timeline.Window
PiperOrigin-RevId: 361741354
2021-03-12 10:40:46 +00:00
gyumin
ae7c1091e6 Implement Bundleable for Timeline.Period
PiperOrigin-RevId: 361736476
2021-03-12 10:40:36 +00:00
gyumin
6f9dbfe0c1 Implement Bundleable for AdPlaybackState
PiperOrigin-RevId: 361731578
2021-03-12 10:40:25 +00:00
gyumin
ffb7c466ed Implement addMediaItems(List) and clearMediaItems() in BasePlayer
PiperOrigin-RevId: 361487730
2021-03-12 10:39:54 +00:00
gyumin
c1dba81ed2 Move TimelineTest to common module
PiperOrigin-RevId: 361125522
2021-03-12 10:39:43 +00:00
gyumin
51f6aea265 Merge AdPlaybackStateTests
PiperOrigin-RevId: 361125492
2021-03-12 10:39:33 +00:00
kimvde
0dcdbf0adf Add Player onAvailableCommandsChanged callback
PiperOrigin-RevId: 361122259
2021-03-12 10:39:22 +00:00
olly
3de81c6d31 HttpDataSources: Remove unused protected methods
PiperOrigin-RevId: 361109018
2021-03-12 10:39:11 +00:00
gyumin
4df7410272 Add javadoc for Bundleable CREATOR fields
It's to comply with style guide as they are public.

PiperOrigin-RevId: 360914363
2021-03-12 10:38:25 +00:00
gyumin
7a02346d49 Recommend BasePlayer when implementing Player
PiperOrigin-RevId: 360902971
2021-03-12 10:38:14 +00:00
gyumin
8fbb971dfa Implement Bundleable for AdGroup
PiperOrigin-RevId: 360851146
2021-03-12 10:37:53 +00:00
jaewan
7fad836b3a Implement Bundleable for PlaybackParameters
PiperOrigin-RevId: 360810865
2021-03-12 10:37:41 +00:00
olly
f5024131b8 Fix typos in Javadoc
PiperOrigin-RevId: 360440021
2021-03-12 10:37:19 +00:00
kimvde
67b18a958e Link to callback in Player getters' Javadoc
PiperOrigin-RevId: 360398175
2021-03-02 17:04:35 +00:00
olly
759b0431bb DataSource: Tighten contract to throw if opened beyond end-of-input
Includes fixes for the HTTP implementations, which previously
broke this contract specifically in the case when a server
responds to a range request with a HTTP 200 response. To fix
this case, skipping to the requested position is moved from
read() to open(). As a side effect, this nicely simplifies
CronetDataSource!

PiperOrigin-RevId: 359737301
2021-03-02 17:03:14 +00:00
krocard
72aec83a9e Add setPlaybackSpeed as a convenience method to change speed.
PiperOrigin-RevId: 359734928
2021-03-02 17:03:05 +00:00
krocard
b050391467 Clarify that set/getVolume is in fact a linear gain.
The API is a lot more useful if apps can rely on the fact
that the gain is linear and applied to all channels.

This is already guaranty by AudioTrack and should be too
by any reasonable implementation.

PiperOrigin-RevId: 359706113
2021-03-02 17:02:35 +00:00
bachinger
66d15cea09 Bump version to 2.13.2
PiperOrigin-RevId: 359486817
2021-02-25 11:41:26 +00:00
krocard
589f50fb22 Move renderer from Player to ExoPlayer
The concept of Renderers is not needed in the
Player interface. Move it to ExoPlayer.

This should not break most users as they use SimpleExoPlayer.

PiperOrigin-RevId: 359220977
2021-02-24 15:46:35 +00:00
kimvde
32e3f15e8f Fix conditions to enable UI actions
- Ensure consistency between (Styled)PlayerControlView,
  PlayerNotificationManager, TimelineQueueNavigator and
  DefaultControlDispatcher.
- Handle the case where a live stream has ended when enabling previous
  and next actions (window.isLive() is true and window.isDynamic is
  false in that case)

#minor-release

PiperOrigin-RevId: 359063793
2021-02-24 15:46:11 +00:00
olly
d8b5a1d7f4 Contract test for end-position-out-of-range case
Assert that an exception is not thrown from DataSource.open
if the DataSpec's start position is valid but its end position
extends beyond the end of the data.

HTTP based DataSource implementations have no good way of
knowing when this is the case, so it makes sense to make this
the required behaviour, rather than requiring an exception to
be thrown or allowing both.

There are also use cases where the caller may want to use the
end position as an upper bound, without knowing for sure how
long the content is. An example of this use case is wanting to
pre-cache the first N bytes of a stream. This implies that any
exception should be thrown after reading to the end of the
data, rather than preemptively in open.

Issue: #7326
PiperOrigin-RevId: 359063721
2021-02-24 15:46:02 +00:00
gyumin
520f77bef5 Mark convenience methods as final in BasePlayer
PiperOrigin-RevId: 359021944
2021-02-23 15:06:28 +00:00
ibaker
c64a1a0c3c Add tests to CopyOnWriteMultisetTest for modification during iteration
This is a key use-case for copy-on-write collections.

PiperOrigin-RevId: 358807866
2021-02-23 12:29:51 +00:00
ibaker
623597addb De-duplicate DRM acquire & release events by EventDispatcher
When we add DRM pre-acquire support to SampleQueue, we'll dispatch
twice the number of acquire and release events. This is slightly
confusing, since there's the same number of
DrmSessionManager#acquireSession() calls.

We can mitigate this by only dispatching each acquire and release
event to at most one EventDispatcher.

This also changes the events fired when playing a stream with both audio
and video encrypted with the same keys (even without pre-acquisition).

Before: The EventDispatcher would see 2 aquires, 1 key load and 2
release events.

After: The EventDispatcher will see 1 acquire, 1 key load and 1 release.
PiperOrigin-RevId: 358804502
2021-02-23 12:29:43 +00:00
gyumin
0eed19d8a3 Add @Documented to FieldNumber @IntDef
PiperOrigin-RevId: 358799813
2021-02-23 12:29:35 +00:00
tonihei
ceb76f35e9 Align pattern of calling deprecated listener methods.
There are two different patterns we use at the moment:
 1. Call both deprecated and non-deprecated method from call site with
    no default method implementation body.
 2. Use default method of non-deprecated method to call deprecated
    method.

Pattern 1 is easier to reason about as it makes the calls more explicit,
so changing all usages of pattern 2 to pattern 1.

PiperOrigin-RevId: 358769803
2021-02-22 10:35:30 +00:00
tonihei
1a12018dae Add ConcatenatingMediaSource version that fully combines windows.
The published Timeline contains one window only with all periods of
the child sources.

Issue: #4868
PiperOrigin-RevId: 358150276
2021-02-19 10:58:05 +00:00
gyumin
dea6a67ce9 Remove nullable utility methods in Bundleable
PiperOrigin-RevId: 357845774
2021-02-19 10:57:32 +00:00
gyumin
2326b56132 Implement Bundleable for MediaItem and MediaMetadata
PiperOrigin-RevId: 357656504
2021-02-19 10:56:52 +00:00
olly
7f5b5c9b6d Add static TrackSelection type
This type is different to the selection reason, which is
dynamic (i.e., corresponds to the individual selected track,
which can change during playback). The static type is
exposed via TrackSelection, where-as the selection reason
will be internal to the core (i.e., player) module.

PiperOrigin-RevId: 357578201
2021-02-19 10:56:27 +00:00
olly
1b6dd40aa5 Move Spherical UI components to the UI module
PiperOrigin-RevId: 357549002
2021-02-19 10:55:46 +00:00
gyumin
6a642ec58b Generalize exception thrown by fromBundle
It allows Bundleable classes throw a RuntimeException which is broader
than IAE. Now, Bundleable implementation may utilize checkNotNull for
brevity.

PiperOrigin-RevId: 357546375
2021-02-19 10:55:37 +00:00
kimvde
842ca9c09f Add method to query whether a command is available
- Other commands will be added later.
- The returned value is a boolean until we decide what it should be.

PiperOrigin-RevId: 357535877
2021-02-19 10:55:20 +00:00
gyumin
c7751344d4 Use compact String keys for Bundleable
To save bytes in serialized format, it uses shorter keys in Bundles.

PiperOrigin-RevId: 357492840
2021-02-19 10:55:11 +00:00
olly
18722bfb0b Bump version to 2.13.1
PiperOrigin-RevId: 357219132
2021-02-12 19:55:57 +00:00
aquilescanta
f8505204cc Move MediaFormatUtil into common
Also move out of the mediacodec package into the util package.

PiperOrigin-RevId: 356949401
2021-02-12 16:39:28 +00:00
olly
493d996c6f Move RepeatModeUtil to common
It's used by the UI and mediasession modules. We may be able to move
it into the UI module if/when the mediasession module goes away.

PiperOrigin-RevId: 356734939
2021-02-11 12:06:02 +00:00
gyumin
753bccec1f Implement Bundleable for media2 MediaItem and related classes
PiperOrigin-RevId: 356622155
2021-02-11 12:05:18 +00:00
andrewlewis
e28332ff82 Add common prefix to loader thread names
All threads created by ExoPlayer should now have the prefix "ExoPlayer:".

PiperOrigin-RevId: 356518037
2021-02-11 12:05:06 +00:00
olly
50db2ee172 Remove deprecated Player.DefaultEventListener
PiperOrigin-RevId: 356479682
2021-02-09 14:00:06 +00:00
olly
94a4b905c9 Make additional modules depend only on common
ControlDispatcher and DefaultControlDispatcher also need
to move to common for the UI module. As does PlaybackPreparer,
although that will be removed entirely in a future release.

PiperOrigin-RevId: 356467394
2021-02-09 13:59:41 +00:00