1350 Commits

Author SHA1 Message Date
olly
a79fbb95d2 Remove unused resources from deprecated GVR module
PiperOrigin-RevId: 368014991
2021-04-13 14:58:33 +01:00
andrewlewis
3ea694b1fb Upgrade IMA SDK dependency to 3.23.0
This brings in another fix for `NullPointerExceptions` within `WebView` callbacks in the IMA SDK, related to companion ads.

Issue: #8447

#minor-release

PiperOrigin-RevId: 367591047
2021-04-09 13:19:14 +01:00
olly
199b9d1689 Convergence: Continue decoupling UI from Core
Move AdsLoader inner classes that are also required by
the UI module into common.

PiperOrigin-RevId: 367414679
2021-04-09 13:19:07 +01:00
bachinger
4c33c5110e Call new onPositionDiscontinuity callback in CastPlayer
PiperOrigin-RevId: 367020270
2021-04-09 13:17:59 +01:00
olly
6f4db96da1 Fix some dependencies
PiperOrigin-RevId: 366972832
2021-04-06 16:14:55 +01:00
olly
1315e11bfd Ffmpeg extension: Wait for channel count and sample rate
When playing TrueHD streams, it's possible that the first decoded
buffer is empty, and that the channel count and sample rate are
still unknown. To correct for this, defer determining the format
until a buffer that will actually be output from the decoder has
been obtained, and only then query the channel count and sample
rate.

Issue: #8616
#minor-release
PiperOrigin-RevId: 366246245
2021-04-01 16:06:59 +01:00
samrobinson
3d3c90b89d Add getMediaMetadata to Player and SimpleExoPlayer.
PiperOrigin-RevId: 366240390
2021-04-01 16:06:43 +01:00
andrewlewis
86a0a405b6 Update instructions for GMaven releasing
Issue: #5246

#minor-release

PiperOrigin-RevId: 366041182
2021-04-01 16:05:53 +01:00
olly
f5a4f3e609 Switch tests to use SimpleExoPlayer
PiperOrigin-RevId: 366033200
2021-04-01 16:05:35 +01:00
bachinger
2fa3675edb [Cast] Notify media item transition only when playing period removed
When playback transitions automatically, the timeline may have changed because the cast device learned about the duration of the next media item and includes this in the new media status that is sent to the CastPlayer. In such a case we need to make sure that we don't report a media item transition with reason PLAYLIST_CHANGED but for reason AUTO.

PiperOrigin-RevId: 366025323
2021-04-01 16:05:18 +01:00
krocard
1526ca5e3c Move add/remove Player.Listener down of BasePlayer
The BasePlayer implementation of add/remove
Listener knows about Components.
As those are removed from the Player
interface, the implementation of those
methods needs to be moved down in Player
implementations.

This commit makes no functional change.

PiperOrigin-RevId: 364985291
2021-04-01 16:03:09 +01:00
bachinger
dc4148d576 Add positions and new reasons to onPositionDiscontinuity
PiperOrigin-RevId: 364861539
2021-03-24 19:56:25 +00:00
kimvde
e1fec35ff3 Add command to seek to default position
PiperOrigin-RevId: 364821216
2021-03-24 18:07:56 +00:00
kimvde
b6290b1164 Add commands only available in SimpleExoPlayer
PiperOrigin-RevId: 364598601
2021-03-24 18:06:46 +00:00
krocard
bb1261da3c setPlaybackParameters no longer accepts null for DEFAULT
Null was an alias for DEFAULT. Remove this for nullness
safety in the API.

The ExoPlayer implementation still checks for null and
replaces it by DEFAULT, so this is ABI compatible.

PiperOrigin-RevId: 364370017
2021-03-24 18:05:57 +00:00
olly
1affbf9357 DataSources: Enforce that opening at end-of-resource succeeds
- Update the three `HttpDataSource` implementations to use the
  Content-Range response header to determine when this is the
  case. The Content-Range header is included when the status
  code is 416. See [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416).
- Update `ByteArrayDataSource` to conform to the requirement.
- Update `DataSourceContractTest` to enforce the requirement.

PiperOrigin-RevId: 363642114
2021-03-24 18:04:27 +00:00
andrewlewis
6a6c70c7c1 Upgrade IMA SDK dependency to 3.22.3
This brings in a fix for `NullPointerExceptions` within `WebView` callbacks in
the IMA SDK.

Issue: #8447
PiperOrigin-RevId: 363627446
2021-03-24 18:03:58 +00:00
krocard
b24d9f64a9 Implement deprecated getPlaybackError in PlayerBase
PiperOrigin-RevId: 363606255
2021-03-24 18:03:48 +00:00
kimvde
adcaf4b027 Add available command to seek to any media item
PiperOrigin-RevId: 363144142
2021-03-24 18:02:38 +00:00
olly
675b81e5f7 DataSource: Tighten contract to return -1 on premature end-of-input
PiperOrigin-RevId: 363001266
2021-03-24 18:02:17 +00:00
kimvde
6c9f9f9def Add available command to seek in current item
PiperOrigin-RevId: 362972550
2021-03-15 19:15:19 +00:00
kimvde
46aab92206 Add permanently available commands
PiperOrigin-RevId: 362906290
2021-03-15 19:15:10 +00:00
andrewlewis
93c9c7a072 Don't update the ad group count when releasing ImaAdsLoader
`ImaAdsLoader` clears its `AdPlaybackState` when it's released but this could
cause `AdsMediaSource` to look up information in the ad playback state that is
no longer in bounds.

Issue: #8693

#minor-release

PiperOrigin-RevId: 362556286
2021-03-15 19:14:34 +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
kimvde
9d2d334091 Add available commands to prepare/play/pause/stop/release.
PiperOrigin-RevId: 362292208
2021-03-12 10:43:48 +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
kimvde
b74bfa1e9a Trigger media item transition event in CastPlayer
#minor-release

PiperOrigin-RevId: 361803897
2021-03-12 10:41:20 +00:00
gyumin
ffb7c466ed Implement addMediaItems(List) and clearMediaItems() in BasePlayer
PiperOrigin-RevId: 361487730
2021-03-12 10:39:54 +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
kimvde
41672c80e7 Fix onPositionDiscontinuity event in CastPlayer
- Avoid having two onPositionDiscontinuity events (seek and transition)
  sent after a seek to another media item.
- Avoid triggering an onPositionDiscontinuity event after a timeline
  change.

#minor-release

PiperOrigin-RevId: 361092914
2021-03-12 10:38:48 +00:00
gyumin
01cb6ee3a3 Replace ObjectsCompat.equals to Util.areEquals
It's for consistency throughout libraries.

PiperOrigin-RevId: 360549525
2021-03-12 10:37:30 +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
kimvde
718c1e773e Update extensions NDK version to latest LTS version
Latest LTS version is better than latest stable version because it will
be supported for longer.

#minor-release
Issue:#8581
PiperOrigin-RevId: 359467482
2021-02-25 09:18:58 +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
bachinger
45b0c98128 Make media session extension depend on common module only
PiperOrigin-RevId: 359001281
2021-02-23 12:30:41 +00:00
gyumin
ff269403bf Lower minSdkVersion to 16 for media2 extension
From media2 1.1.0, it supports API level 16 and above.

PiperOrigin-RevId: 358797986
2021-02-23 12:29:27 +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
andrewlewis
e009322edd Fix seeking to a non-zero position in a preloaded ad item
`ImaAdsLoader` will preload the first ad of a subsequent media item, but the
preloaded ad might not actually play because the user could seek to a non-zero
position in that media item (which could trigger playback of a midroll, not the
preroll). In this case, playback would get stuck because the midroll ad
expected to play after the seek would never load, because the IMA SDK expected
the preroll to play first.

Fix this behavior by discarding the preloaded ad break. If there isn't a seek,
the transition to the next media item is still seamless.

#minor-release

PiperOrigin-RevId: 357682510
2021-02-19 10:57:00 +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
andrewlewis
f74918a674 Fix ad tag loader period index
Previously it was safe to query the first period in the timeline, but
now we support using the ads loader in concatenations we need to use
the current period index instead.

#minor-release

PiperOrigin-RevId: 357578003
2021-02-19 10:56:19 +00:00
kimvde
926884d2f2 Upgrade extensions NDK version
#minor-release
Issue:#8581
PiperOrigin-RevId: 357563419
2021-02-19 10:56:02 +00:00
christosts
086d8f3a8e Contract test for TransferListener callbacks
PiperOrigin-RevId: 357190780
2021-02-12 16:40:40 +00:00
andrewlewis
41c94edcc2 Add a method to focus the 'skip ad' button, if shown
Issue: #8565

#minor-release

PiperOrigin-RevId: 356691251
2021-02-11 12:05:39 +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
olly
c501908dad Remove deprecated extension-jobdispatcher module
PiperOrigin-RevId: 356456843
2021-02-09 13:59:32 +00:00