587 Commits

Author SHA1 Message Date
krocard
6a30af567f Add Commands.Builder.addAllCommands for easy init
MediaSession default command state contains all
commands.
To avoid having to update MediaSession when a command
is added, allow to create a Commands.Builder that
starts with all commands.

PiperOrigin-RevId: 374183484
2021-05-17 18:19:53 +01:00
aquilescanta
17209ed1ee Use the term equivalent instead of equal in assertion
The assertion doesn't check equality (as in x.equals(y)), but rather
whether a subset of the fields are equal.

PiperOrigin-RevId: 374183338
2021-05-17 18:19:32 +01:00
olly
2566b24642 Remove deprecated Listener.onTimelineChanged
PiperOrigin-RevId: 374171038
2021-05-17 18:19:13 +01:00
christosts
1dfda7ab6e ForwardingPlayer implements Player
Make ForwardingPlayer implement Player and not extend BasePlayer so that
ForwardingPlayer forwards each Player method directly to the wrapped
Player instance.

PiperOrigin-RevId: 374161084
2021-05-17 18:18:14 +01:00
tonihei
795210d7bc Update player logic to handle server-side inserted ads.
There are two main changes that need to be made:
 1. Whenever we determine the next ad to play, we need to select a
    server-side inserted ad even if it has been played already (because
    it's part of the stream).
 2. When the Timeline is updated in the player, we need to avoid changes
    that would unnecessarily reset the renderers. Whenever a Timeline
    change replaces content with a server-side inserted ad at the same
    position we can just keep the existing MediaPeriod and also if the
    duration of the current MediaPeriod is reduced but it is followed by
    a MediaPeriod in the same SSAI stream, we can don't need to reset
    the renderers as we keep playing the same stream.

PiperOrigin-RevId: 373745031
2021-05-14 11:24:46 +01:00
aquilescanta
a8675673da Add backward compatibility tests for PlaybackException
PiperOrigin-RevId: 373542819
2021-05-13 10:52:59 +01:00
tonihei
954a6730d5 Allow ad groups to be marked as server-side inserted.
This helps both player the logic and clients like UI or analytics to
detect SSAI ads.

PiperOrigin-RevId: 373540754
2021-05-13 10:52:37 +01:00
klhyun
bec7b0041e Make Cue implement Bundleable
In order to deliver Cue objects between different processes
(e.g. in Player#getCurrentCues), this CL makes it Bundleable.

PiperOrigin-RevId: 373524501
2021-05-13 10:52:12 +01:00
samrobinson
46c5f030ce Add an artwork field to MediaMetadata
#minor-release

PiperOrigin-RevId: 373410795
2021-05-13 10:51:02 +01:00
tonihei
ef5a0b6c4d Allow ad groups to specify a resume offset.
Content after ad groups currently always resumes at the ad break position (unless
overridden by a seek or similar).  In some cases, media inserting ads wants to
specify an offset after the ad group at which playback should resume. A common
example is a live stream that inserts an ad and then wants to continue streaming
at the current live edge.

Support this use case by allowing ad groups to specify a content resume offset
and making sure that the content start position after the ad group uses this offset.

PiperOrigin-RevId: 373393807
2021-05-12 18:57:45 +01:00
jaewan
43da862780 Add copy constructor and remove APIs for Commands builder
It helps to change allowed commands from session.

PiperOrigin-RevId: 373302990
2021-05-12 11:52:49 +01:00
jaewan
b2b6e0ecb5 Implements Player.Events#equals()
It's convenient for testing.

PiperOrigin-RevId: 373280130
2021-05-12 11:52:25 +01:00
aquilescanta
ad46b90918 Use Truth convenience methods for Exception-related assertions
PiperOrigin-RevId: 373180764
2021-05-12 11:51:40 +01:00
aquilescanta
094f4a8436 Add notice about backwards compatibility in PlaybackException
PiperOrigin-RevId: 373172693
2021-05-11 17:47:26 +01:00
aquilescanta
d54168ae30 Make ExoPlaybackException extend PlaybackException
PiperOrigin-RevId: 373170792
2021-05-11 17:39:52 +01:00
olly
0c19506d7d Remove deprecated Format.create methods
PiperOrigin-RevId: 373144415
2021-05-11 16:02:08 +01:00
kim-vde
eb93e5c0b5 Merge pull request #8860 from KeiMurayamaS:dev-v2-add-mpegh-parser
PiperOrigin-RevId: 373142159
2021-05-11 16:01:46 +01:00
tonihei
08fb7bd65f Support changing ad break positions.
The player already supports changing durations of periods and ads.
The only thing not yet supported is a change in ad break positions
which changes the duration of clipped content ending in an ad break.

Adding support for this requires updating the end position in
MediaPeriodInfo and changing the clip end position of the respective
ClippingMediaPeriod.

Issue: #5067
PiperOrigin-RevId: 373139724
2021-05-11 16:01:25 +01:00
olly
b95fba2cb7 Remove deprecated Timeline.getWindow method
PiperOrigin-RevId: 373126944
2021-05-11 16:00:40 +01:00
aquilescanta
508c6652ba Add test for PlaybackException
PiperOrigin-RevId: 373026239
2021-05-10 23:42:51 +01:00
olly
89cfa4df32 Remove some deprecated Player methods
PiperOrigin-RevId: 372981744
2021-05-10 23:42:10 +01:00
aquilescanta
763ef2b911 Avoid type-ambiguous overloads in ExoPlaybackExceptionTest
PiperOrigin-RevId: 372942778
2021-05-10 23:41:09 +01:00
tonihei
8a5d21adef Remove reference to deprecated Player.EventListener.
#minor-release

PiperOrigin-RevId: 372925409
2021-05-10 23:40:26 +01:00
olly
3c64bc1b49 Fix Javadoc references to deprecated EventListener
#minor-release

PiperOrigin-RevId: 372919342
2021-05-10 23:40:05 +01:00
olly
e908750336 Bump version to 2.14.0 and tidy release notes
#minor-release

PiperOrigin-RevId: 372910834
2021-05-10 23:39:25 +01:00
Kei Murayama
f05197c4d5 Support parsing MPEG-H 3D Audio
First intention to support parsing MPEG-H 3D Audio in ExoPlayer is to
take advantage of parsing capability from MediaParser API in AOSP.
Just with this change ExoPlayer does't support decoding MPEG-H 3D Audio
but can support decoding either by adding decoder with an extension or
by using Android OS which has decoder capability with MediaCodec API.
2021-05-10 17:55:03 +09:00
aquilescanta
f415ea2372 Make PlaybackException's Bundleable implementation subclass friendly
PiperOrigin-RevId: 372552003
2021-05-10 09:37:51 +01:00
samrobinson
1a6984fbe0 Add javadoc to the MediaMetadata setters.
#minor-release

PiperOrigin-RevId: 372549185
2021-05-10 09:37:33 +01:00
aquilescanta
e96fde5fe4 Add an IntDef for PlaybackException's Bundle key fields
PiperOrigin-RevId: 372548259
2021-05-10 09:37:14 +01:00
samrobinson
2914e574e6 Rename MediaMetadata trackTitle and trackArtist to title and artist.
#minor-release

PiperOrigin-RevId: 372537414
2021-05-07 14:58:03 +01:00
samrobinson
09a8993b56 Add fields to MediaMetadata requested by MediaAPIs
#minor-release

PiperOrigin-RevId: 372448985
2021-05-07 10:22:27 +01:00
samrobinson
bbeedd5e76 Use getters in Rating subclasses rather than direct field access.
#minor-release

PiperOrigin-RevId: 372368685
2021-05-07 10:21:50 +01:00
aquilescanta
1408fe0403 Remove ExoPlaybackException's cause field
It was originally introduced because it was guaranteed to be non-null
unlike the inherited field. But ExoPlaybackException.cause has been
nullable for some time, so there's no gain in not using the inherited
field.

PiperOrigin-RevId: 372329740
2021-05-07 10:21:28 +01:00
jinpark
d388ab25cc Make Player.Commands Bundleable
PiperOrigin-RevId: 372266634
2021-05-06 13:34:04 +01:00
aquilescanta
1f83926d2f Reserve x000 error codes for the UNSPECIFIED error codes
PiperOrigin-RevId: 372146069
2021-05-06 13:33:25 +01:00
tonihei
61bbdb3794 Add missing isPlaceholder forwarding in SinglePeriodAdTimeline
Also make future similar issues less likely by adding isPlaceholder
to the set method of Period (in case forwarding Timeline
implementations use this instead of just updating values selectively)

#minor-release

PiperOrigin-RevId: 372138523
2021-05-06 13:33:06 +01:00
bachinger
4c1a294b2e Format Java source files
PiperOrigin-RevId: 372127633
2021-05-06 13:32:25 +01:00
aquilescanta
10ee4689f1 Fix some comments pending from previous change
PiperOrigin-RevId: 372094221
2021-05-06 13:31:47 +01:00
olly
9626e24905 Remove Format.create deprecated methods
PiperOrigin-RevId: 372088869
2021-05-06 13:30:50 +01:00
aquilescanta
0b7865ead9 Add PlaybackException error codes
PiperOrigin-RevId: 371919596
2021-05-04 18:35:55 +01:00
olly
a264a0a04f Remove deprecated UI methods
PiperOrigin-RevId: 371809078
2021-05-04 11:18:26 +01:00
gyumin
416bd43584 Revise javadoc for Rating classes
PiperOrigin-RevId: 371625281
2021-05-04 11:17:44 +01:00
jinpark
f7a8c6e4de Add command for setting media items metadata
PiperOrigin-RevId: 371482546
2021-05-04 11:17:22 +01:00
krocard
3dc6cf6bec Deprecate EventListener in favor of Listener
#minor-release

PiperOrigin-RevId: 371348520
2021-04-30 18:56:35 +01:00
krocard
ffe31be08b Deprecate component listener in favor of player
All `add*Listener` and `add*Output` methods are
deprecated in favor of `addListener`.

As for the class themselves `VideoListener` and
`AudioListener` are not used internaly by ExoPlayer,
`VideoRendererEventListener`
and `AudioRendererEventListener` are use in their
place.
As a result `VideoListener` and `AudioListener`
can be deprecated in favor `Listener`.

On the other hand `TextOutput` and `MedataOutput`
are used both in the player interface and internally in
renderers.
This means that those class can't be deprecated.
There usage in the public interface are indirectly
deprecated as their is no way to use them without
using the deprecated `add*Output`.
Thus it's not an issue that the class themselves are
not deprecated.

#minor-release

PiperOrigin-RevId: 371318268
2021-04-30 18:55:06 +01:00
dlafayet
8c7d6447c0 Merge #8858: Support ebutts:multiRowAlign in TTML text renderer
Imported from GitHub PR https://github.com/google/ExoPlayer/pull/8858

Fix bug in text alignment inheritance where child does not correctly inherit ancestor's setting

@icbaker
Merge 70eb4bceb73b3f07e2f8d545b4fa7961189ac52a into 45616f916b28c9187b3e0f0dd18797464a079cdc

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/ExoPlayer/pull/8877 from dlafayet:multirowalign-cue d942b50a40525fea5d11b35a33d3bbc512550960
PiperOrigin-RevId: 371306966
2021-04-30 18:54:13 +01:00
christosts
7d2a2aa283 Override available commands in ForwardingPlayer
This change adds an API in the ForwardingPlayer to disable commands.
This is affecting what Player.isCommandAvailable() returns as
well as what is being advertised from the
EventListener.onAvailableCommandsChanged() callback.

For the callback case, the ForwardingPlayer needs to intercept the
callback. It does so by wrapping registered EventListener and Listener
instances, which resulted in some boiler-plate code. In addition, there
is logic on the wrapped listeners to avoid triggering a queued callback
if all listeners have been removed in the meantime. This includes the
case where new listeners are added while callbacks scheduled for the
removed listeners are still pending.

PiperOrigin-RevId: 371139703
2021-04-30 11:43:48 +01:00
bachinger
cdff456621 Make copybara remove the LINT.IfChange tag
PiperOrigin-RevId: 371135534
2021-04-29 17:35:05 +01:00
andrewlewis
a695cbd2ca Update internal codebase location for common module
PiperOrigin-RevId: 371109726
2021-04-29 17:34:32 +01:00
krocard
de895c4894 Add get video size
Move VideoSize in the common module and have the Player return it.

`Listener` and `AnalyticsListener` `onVideoSizeChanged` are updated
with the old method deprecated.

`VideoRendererEventListener.onVideoSizeChanged` was also migrated to
`VideoSize` but the old method is removed, not deprecated.
This is because:
 - apps calling/listening to this method is a rare and niche use-case.
 - it would introduce hard to diagnostic issues where if only the caller
   or the callee is updated to use the new method, the event will be lost.
   This doesn't occur with the other 2 listeners as the caller is always
   in ExoPlayer library and was updated to call both the old and new methods.

VideoSize is used everywhere except in `Format` as this would lead to
too much refactoring and backward compatibility breakage for little gain.

#minor-release

PiperOrigin-RevId: 371087419
2021-04-29 11:44:03 +01:00