710 Commits

Author SHA1 Message Date
kimvde
e2f1285ada Document getAvailableCommands in BasePlayer
PiperOrigin-RevId: 386207381
2021-07-22 13:49:21 +01:00
ibaker
1466c75d4d Bump version to 2.14.2 and tidy release notes
#minor-release

PiperOrigin-RevId: 385996618
2021-07-21 14:50:26 +01:00
claincly
e4c9078a0c Infer error code in network-based DataSourceException.
In some DataSources, it is not easy to assign an error code at the throw site.
For example, CronetDataSource.readInternal() throws SocketTimeoutException
on L1033, and is caught at L754 as IOException and is thrown.

We need the logic to assign error code for the actual type of the error cause.
While we can certainly do in individual DataSources, IMO there's value in
making this logic generic at a higher level (like what is in this CL).

The catch and translation logic is borrowed from EPII:L646.

PiperOrigin-RevId: 385789629
2021-07-21 14:46:40 +01:00
samrobinson
d47d1ebf19 Deprecate static metadata getter and listener method.
PiperOrigin-RevId: 385781004
2021-07-21 14:44:00 +01:00
samrobinson
c157db694a Split MediaMetadataTest cases into PictureFrameTest and ApicFrameTest.
PiperOrigin-RevId: 385758742
2021-07-21 14:39:56 +01:00
samrobinson
fde3075af1 Add an artworkDataType to MediaMetadata.
This field is to be associated with the artworkData.

PiperOrigin-RevId: 385757480
2021-07-21 14:38:30 +01:00
samrobinson
135eb3f8cf Split some MediaMetadataTest cases into TextInformationFrameTest.
PiperOrigin-RevId: 385562351
2021-07-20 08:52:38 +01:00
kimvde
fa1bb32deb Remove deprecated PlaybackPreparer
Also update release note to account for upcoming ControlDispatcher removal.

PiperOrigin-RevId: 385520701
2021-07-20 08:47:26 +01:00
kimvde
3830848888 Use Player methods in DefaultControlDispatcher
PiperOrigin-RevId: 385118021
2021-07-20 08:36:46 +01:00
claincly
6512463280 Make network-based DataSource implementations use ErrorCode.
PiperOrigin-RevId: 384666131
2021-07-14 12:19:49 +01:00
kimvde
ae31ebb143 Rename previous/next to seekToPrevious/NextWindow in Player
Also rename hasPrevious/Next to hasPrevious/NextWindow for consistency.

This makes it clearer what the difference between
seekToPrevious/NextWindow and seekToPrevious/Next is.

PiperOrigin-RevId: 384643373
2021-07-14 12:17:15 +01:00
olly
e403dda105 End ListenerSet iteration sooner
PiperOrigin-RevId: 384500287
2021-07-14 12:14:19 +01:00
olly
949f715c6b Avoid IncorrectContextUseViolation on Android 11
Applications may need to pass a non-visual context when creating
a DefaultTrackSelector (e.g., because they're audio-only or are
creating the selector in a background service).

Obtaining the default display via DisplayManager avoids the strict
mode violation that occurs when retrieving it via WindowManager.

#minor-release

PiperOrigin-RevId: 384487363
2021-07-14 12:13:06 +01:00
kimvde
58541fa1d1 Add SEEK_TO_NEXT command
PiperOrigin-RevId: 384477188
2021-07-14 12:11:46 +01:00
kimvde
8451be1b0b Add SEEK_TO_PREVIOUS command
PiperOrigin-RevId: 384257929
2021-07-13 10:09:06 +01:00
ibaker
1058997e38 Explicitly override all non-deprecated methods in Player.Listener
Most of the super-interfaces are deprecated, but the intention is that
only the types are deprecated and the methods themselves shouldn't be.
In order to reflect this in javadoc we override all the methods in
`Player.Listener` in order to 'cancel' the deprecation.

This change deliberately doesn't override methods that are explicitly
deprecated with documented replacements (like
`Player.EventListener#onPlayerStateChanged`) - these should contine to
be marked as deprecated in javadoc.

PiperOrigin-RevId: 384253725
2021-07-13 10:07:54 +01:00
aquilescanta
6c37c3c2f4 Add ERROR_CODE_DRM_LICENSE_EXPIRED for KeysExpiredException
The errorCode assignment will be done in a following CL.

PiperOrigin-RevId: 384230228
2021-07-13 10:05:20 +01:00
claincly
ca28d6a041 Move TYPE definition out from DataSourceException.
The types (open/close/read) does not provide extra information about the thrown
playback exception, and they are not utilized at higher levels.

PiperOrigin-RevId: 384219870
2021-07-13 10:03:01 +01:00
kimvde
d84e19a302 Rename COMMAND_GET_MEDIA_ITEMS to COMMAND_GET_TIMELINE
This is more descriptive.

PiperOrigin-RevId: 383887927
2021-07-13 10:01:46 +01:00
kimvde
7031c4398d Re-order next and previous commands
This is consistent with seek back and forward commands.

PiperOrigin-RevId: 383867710
2021-07-13 10:00:31 +01:00
kimvde
bc0f3935d6 Re-order seekBack and seekForward in Player
This is more consistent with other Player methods like previous and
next.

PiperOrigin-RevId: 383832298
2021-07-13 09:59:14 +01:00
kimvde
699579fd4e Add seekToNext method to Player
PiperOrigin-RevId: 383816880
2021-07-13 09:57:58 +01:00
kimvde
7e6d82237a Rename MEDIA_ITEM to WINDOW is seek commands
This is more correct and is consistent with the Javadoc.

PiperOrigin-RevId: 383808096
2021-07-13 09:56:42 +01:00
krocard
298af78b4e Move most of DefaultTrackSelector params to TrackSelectionParameters
The parameters staying in DefaultTrackSelector are considered
too ExoPlayer specific to be part of the `Player` interface.
Those are:
 - exceedVideoConstraintsIfNecessary;
 - allowVideoMixedMimeTypeAdaptiveness;
 - allowVideoNonSeamlessAdaptiveness;
 - exceedAudioConstraintsIfNecessary;
 - allowAudioMixedMimeTypeAdaptiveness;
 - allowAudioMixedSampleRateAdaptiveness;
 - allowAudioMixedChannelCountAdaptiveness;
 - disabledTextTrackSelectionFlags;
 - exceedRendererCapabilitiesIfNecessary;
 - tunnelingEnabled;
 - allowMultipleAdaptiveSelections;
 - rendererDisabledFlags

Track selection override will be migrated in a follow up cl.

To avoid breaking backward compatibility,
`DefaultTrackSelector.Parameters` extends
`TrackSelectionParameters` and
`DefaultTrackSelector.ParametersBuilder` extends `TrackSelectionParameters.Builder`.
The change are thus transparent for clients.

Test are incomplete for now, as this is a relatively big cl, I though
the reviewer could give a first pass will the tests are completed.

PiperOrigin-RevId: 383767021
2021-07-09 09:25:15 +01:00
ibaker
20d67eb34a Rename Player.EventFlags -> Player.Event
IntDef names (like enums) are normally singular, and this isn't a 'flag'
IntDef.

PiperOrigin-RevId: 383659574
2021-07-09 09:22:54 +01:00
kimvde
e828dfbd7c Add getMaxSeekToPreviousPosition to Player
PiperOrigin-RevId: 383656919
2021-07-09 09:21:27 +01:00
kimvde
c4e99902c3 Add seekToPrevious method to Player
PiperOrigin-RevId: 383623440
2021-07-09 09:20:04 +01:00
krocard
0dd296c2c9 Move BundleableUtil in common
It is used to implement `Bundleable` for
`TrackSelection`.

PiperOrigin-RevId: 383408386
2021-07-09 09:17:57 +01:00
aquilescanta
8b1fcfc40f Drop support for subclass instance unbundling in PlaybackException
PiperOrigin-RevId: 383408075
2021-07-09 09:16:41 +01:00
kimvde
1608f6f9da Remove the seekBack/Forward increment setters
This simplifies the API surface and the MediaController implementation.

PiperOrigin-RevId: 383385436
2021-07-09 09:12:49 +01:00
aquilescanta
73b5d0c37b Expand documentation of ERROR_CODE_DRM_CONTENT_ERROR
PiperOrigin-RevId: 383382813
2021-07-09 09:11:34 +01:00
aquilescanta
5b2e854344 Add missing call and rename getErrorCodeForMediaDrmErrorCode
PiperOrigin-RevId: 383251000
2021-07-09 09:06:00 +01:00
kimvde
15c565c7d7 Rename fastForward/rewind to seekForward/Back in Player
This matches the Javadoc better.

PiperOrigin-RevId: 383228021
2021-07-09 09:02:17 +01:00
ibaker
ee488e6625 Clarify the thread requirements of a SurfaceView or SurfaceHolder
Issue: #9005
PiperOrigin-RevId: 382765045
2021-07-09 08:54:07 +01:00
ibaker
5e4056eb4c Encode emsg duration & ID as int64 instead of uint32
The serialization scheme used here is custom, it doesn't need
to be compatible with emsg-v0 or emsg-v1 (since
97183ef558).

This means that C.TIME_UNSET will propagate correctly through the
serialization.

#minor-release

Issue: #9123
PiperOrigin-RevId: 382762873
2021-07-09 08:49:27 +01:00
ibaker
ee426822ee Mark BasePlayer constructor as protected
This is an abstract class so it can only be constructed from the context
of a subclass anyway.

PiperOrigin-RevId: 382756293
2021-07-09 08:46:58 +01:00
claincly
6035932fa3 Make HttpDataSourceException use PlaybackException error codes.
PiperOrigin-RevId: 382710409
2021-07-09 08:44:36 +01:00
claincly
747b0f057b Make DataSourceException use PlaybackException error codes.
- Use `PlaybackException.ErrorCode` IntDef for `DataSourceException` error code
- Deprecate `DataSourceException.POSITION_OUT_OF_RANGE`
- All other changes are related to replacing the deprecated constant and
  constructor

PiperOrigin-RevId: 382683522
2021-07-09 08:43:22 +01:00
claincly
ee0d905eed Add ERROR_CODE_TIMEOUT.
Also remove the method for creating a TYPE_RENDERER ExoPlaybackException
with unknown renderer name and index.

PiperOrigin-RevId: 382589655
2021-07-09 08:40:38 +01:00
claincly
dda1d37368 Make HttpDataSourceException subclass DataSourceException.
PiperOrigin-RevId: 382551642
2021-07-09 08:39:26 +01:00
aquilescanta
b0ddef5bcf Assign DRM error codes
PiperOrigin-RevId: 382527115
2021-07-09 08:38:13 +01:00
aquilescanta
c1995745e7 Move platform error mapping to common
In order to use it for error code assignment. Note that these DRM errors
could be thrown on API < 18 (from MediaCodec.CryptoException), which is
the reason we can't put the mapping in FrameworkMediaDrm.

PiperOrigin-RevId: 382512414
2021-07-09 08:36:53 +01:00
aquilescanta
124a6aea50 Remove unused method Log.getLogStackTraces
It was impossible to call because it was a non-static method in a class
with a private constructor.

PiperOrigin-RevId: 382504128
2021-07-09 08:34:38 +01:00
krocard
4de4f85739 Document threading guarantee of Player.addListener
These guarantees were documented for `EventListener` and
hold as well for Listener but were not documented.

PiperOrigin-RevId: 382498188
2021-07-09 08:33:26 +01:00
aquilescanta
a24bbbdd5e Reimplement getErrorCodeFromPlatformDiagnosticsInfo to save the pattern
PiperOrigin-RevId: 382494191
2021-07-09 08:31:10 +01:00
aquilescanta
d9d02710c0 Add tests for Util.getErrorCodeFromPlatformDiagnosticsInfo
PiperOrigin-RevId: 382311518
2021-07-09 08:27:17 +01:00
aquilescanta
2ca7432bf6 Move Util.getErrorCodeFromPlatformDiagnosticsInfo into common
Will be needed for error code assignment.

PiperOrigin-RevId: 382305328
2021-07-09 08:26:03 +01:00
Scott
dffcf258ee Updated mimetypes to support DTSX and to correct assign dtse to DTS Express 2021-07-08 11:11:26 +01:00
olly
dea52048cb Bump dependency versions
PiperOrigin-RevId: 382277352
2021-06-30 13:53:01 +01:00
samrobinson
9013facdd7 Rename PlaylistMediaMetadata to PlaylistMetadata in Player.
This affects the setter, getter and callback, as well as various
media 3 methods.

PiperOrigin-RevId: 382275672
2021-06-30 13:51:51 +01:00