1676 Commits

Author SHA1 Message Date
bachinger
61a38a1920 Map PLAYER_STATE_LOADING to STATE_BUFFERING
#minor-release
Issue: androidx/media#245
PiperOrigin-RevId: 510456793
(cherry picked from commit a231ff4fa91471c59d2ab62945603614b8c8a742)
2023-02-28 18:04:03 +00:00
bachinger
65f2e16708 Add ad event listeners in the Looper event of the ad manager callback
#minor-release

PiperOrigin-RevId: 509189206
(cherry picked from commit e98670e2f94a04d90f6ec7188f748eb1c31fb09f)
2023-02-28 18:04:03 +00:00
ibaker
4dfa7ca249 Fix (another) LeanbackPlayerAdapter param name mismatch
I missed this when fixing `positionInMs` for Dackka in d2a3d8f6fa

This time I manually verified that all the `@Override` methods have
parameter names that match [the docs](https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter).

#minor-release

PiperOrigin-RevId: 506017063
(cherry picked from commit 736f090cce540de78a968e62fd8c5aec413e8122)
2023-02-02 13:18:47 +00:00
christosts
26c8c552c0 Suppress warnings in ImaUtil
ImaUtil calls VideoProgressUpdate.equals() which is annotated as hidden,
which causes lint errors with gradle.

#minor-release

PiperOrigin-RevId: 504306210
(cherry picked from commit f86948f01c2397b9f53ef598e311e2de9055118e)
2023-01-26 14:28:06 +00:00
bachinger
4b3c74fb37 Clarify what default settings are being used for SSAI AdsLoader
PiperOrigin-RevId: 502388865
(cherry picked from commit 26e1a28176d8520890802c0a50aec8bc710eb2c3)
2023-01-25 18:29:36 +00:00
bachinger
8f37ad6bf8 Add AdsLoader.focusSkipButton()
This method allows to call through to `StreamManager.focus()` of the currently playing SSAI stream.

PiperOrigin-RevId: 501399144
(cherry picked from commit 0ba0c0ed43fbcf4a57f6fc91829ba00d72e3672f)
2023-01-25 18:29:36 +00:00
bachinger
61eeb8b15e Add focusSkipButtonWhenAvailable to focus UI on ATV
For TV devices the skip button needs to have the focus to be accessible with
the remote control. This property makes this configurable while being set to
true by default.

PiperOrigin-RevId: 501077608
(cherry picked from commit d2898b70ead3b2ad1244a730c3b456146755c138)
2023-01-25 18:29:36 +00:00
rohks
0b95e2ca01 Initialise fields used for bundling as String directly
Initialising the fields as Integer and then getting a String on compute
time is slow. Instead we directly initialise these fields as String.
Improves the time taken in bundling PlayerInfo further to less than
200ms from ~300ms.

Also modified a test to improve productive coverage.

PiperOrigin-RevId: 500003935
(cherry picked from commit d49437c6e112e60e9c85edeef73a73bce7de939a)
2023-01-25 18:29:35 +00:00
bachinger
25c964d71d Remove player listener on the application thread of the player
PiperOrigin-RevId: 497183220
(cherry picked from commit 965606f7a7626b95087845191f9b6d4c33ced2e7)
2023-01-25 18:29:35 +00:00
bachinger
0417dbae78 Bump IMA SDK version to 3.29.0
Issue: google/ExoPlayer#10845
PiperOrigin-RevId: 496947392
(cherry picked from commit 8ed515880a0b6c05b766e868e2ef931b886925cc)
2023-01-25 18:29:35 +00:00
ibaker
beeb6e7eed Fix Dackka error due to param name mismatch
https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter#seekTo(long)

#minor-release

PiperOrigin-RevId: 496378709
(cherry picked from commit d2a3d8f6fabb6d22ac28a76379725d0915344cba)
2023-01-25 18:29:35 +00:00
tonihei
f1784862e0 Clarify behavior for out-of-bounds indices and align implementations
Some Player methods operate relative to existing indices in the
playlist (add,remove,move,seek). As these operations may be issued
from a place with a stale playlist (e.g. a controller that sends
a command while the playlist is changing), we have to handle out-
of-bounds indices gracefully. In most cases this is already
documented and implemented correctly. However, some cases are not
documented and the existing player implementations don't handle
these cases consistently (or in some cases not even correctly).

PiperOrigin-RevId: 495856295
(cherry picked from commit a1c0b10482baffc3721561446ee4bb788d8a1231)
2023-01-25 18:29:34 +00:00
tonihei
b9365f5563 Forward seek command details to seekTo method in BasePlayer
BasePlayer simplifies implementations by handling all the various
seek methods and forwarding to a single method that can then be
implemented by subclasses. However, this loses the information about
the concrete entry point used for seeking, which is relevant when
the subclass wants to verify or filter by Player.Command. This
can be improved by adding the command as a new parameter. Since
we have to change the method anyway, we can also incorporate the
boolean flag about whether the current item is repeated to avoid
the separate method.

PiperOrigin-RevId: 494948094
(cherry picked from commit 6e0f1f10b3666e6c2c74fc5a154dec3f0e03fecb)
2023-01-25 18:29:34 +00:00
ibaker
d2d45dbe17 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
(cherry picked from commit c006575d4306f9bfad9c6f27d964fab00a6e1718)
2023-01-25 18:29:34 +00:00
bachinger
69ded0f28c Bump cast sdk version and remove workaround for live duration
The fix for b/171657375 (internal) has been shipped with 21.1.0 already (see https://developers.google.com/cast/docs/release-notes#august-8,-2022).

PiperOrigin-RevId: 491583727
(cherry picked from commit 04f031d16805a6d6786d135f77d0f6e79c77c8f7)
2023-01-25 17:39:48 +00:00
Rohit Singh
cbc2547043 Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
(cherry picked from commit c827e46c3db2691b1b5fed57fa5b67890331aa85)
2023-01-25 17:39:48 +00:00
ibaker
87b1c30d75 Add set -eu to all shell scripts
These flags ensure that any errors cause the script to exit (instead of
just carrying on) (`-e`) and that any unrecognised substitution variables
cause an error instead of silently resolving to an empty string (`-u`).

Issues like Issue: google/ExoPlayer#10791 should be more quickly resolved with
`set -e` because the script will clearly fail with an error like
`make: command not found` which would give the user a clear pointer
towards the cause of the problem.

#minor-release

PiperOrigin-RevId: 490001419
(cherry picked from commit f83441974411dca5673a34548b11bc6e6cb809ff)
2023-01-25 17:33:06 +00:00
christosts
a114b0e01f Fix compilation error in ffmpeg JNI layer
PiperOrigin-RevId: 490263003
(cherry picked from commit 202e03fc64dac568955ce00684368cbea9b244f7)
2022-11-23 09:51:59 +00:00
ibaker
bd6570f6c7 Remove @hide javadoc annotation from ExoPlayer GitHub
This tag is only understood by Dackka, which is used to generate the media3 javadoc.

PiperOrigin-RevId: 489233200
(cherry picked from commit 058cba95d40db83c77f4dd0aa8cb561221463b3a)
2022-11-22 11:04:51 +00:00
tonihei
6108c053ce Rename getVideoSurfaceSize to getSurfaceSize
This better matches the callback name (onSurfaceSizeChanged) and
probably cause less confusion with getVideoSize.

PiperOrigin-RevId: 488669786
(cherry picked from commit 8438daca1f8cbea24aa414ee500044baf1a28367)
2022-11-17 10:03:11 +00:00
ibaker
d97604138e Add missing IntDef on MediaSource.Factory.getSupportedTypes overrides
Without this the annotation isn't shown in javadoc (same in Dackka)

No annotation:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.html#getSupportedTypes()

Annotation present:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/MediaSource.Factory.html#getSupportedTypes()

#minor-release

PiperOrigin-RevId: 487498450
(cherry picked from commit 4949fbe5edc9dbbf1a713b152907cc3a175956d5)
2022-11-10 12:24:56 +00:00
ibaker
77c8875be6 Fix Dackka parameter name error in Gav1Decoder and VpxDecoder
These aren't caught by presubmit because the classes are annotated
`@VisibleForTesting` and are therefore stripped out by Metalava. However
Metalava doesn't run when we're generating javadoc for real.

#minor-release

PiperOrigin-RevId: 487476260
(cherry picked from commit 14e23d34e17afa076cd912264bb60685961c58e3)
2022-11-10 10:19:01 +00:00
ibaker
925e733010 Fix Dackka/Metalava errors in av1, flac, ffmpeg, midi, and opus modules
This uses `@hide` on `protected final` methods to hide them from Dackka
javadoc generation, since these methods are inaccessible to developers
anyway. These symbols will still (currently) be included in artefacts
distributed on Maven (because we don't run Metalava as part of
generating these artefacts).

In some cases I had to change the visibility/finality of methods to make
them `protected final` before adding the `@hide` annotation (but
the impact should be very low, since most of these methods were either
already unusable by app developers, or they shouldn't have been used).

#minor-release

PiperOrigin-RevId: 487472907
(cherry picked from commit 1cd488ac9a1e838139495f55aa32eb951f1e8d8f)
2022-11-10 10:00:14 +00:00
ibaker
01f30f0b96 Fix Dackka/Metalava errors in the ExoPlayer module
This makes two types of fix:
1. Align parameter names on overridden methods where the superclass
   has `@param` javadoc.
2. Use `@hide` on `protected final` methods that refer to package-private
   types. This will hide these symbols from Dackka javadoc generation
   but not (currently) from the artefacts distributed on Maven. These
   methods are currently unusable outside their package anyway (e.g. by
   external developers) because of the dependency on a package-private
   type.

This also changes some HLS, SmoothStreaming, and IMA code where I've renamed
parameters of overridden methods to be consistent across the type
hierarchy.

#minor-release

PiperOrigin-RevId: 487472665
(cherry picked from commit 10c4a4dfc172cfac77528c7cb746fe827ca6f78c)
2022-11-10 09:58:57 +00:00
Tolriq
95d9e4926d Merge Issue: google/ExoPlayer#10762: Fix ffmpeg jni wrapper returning invalid result codes
Imported from GitHub PR Issue: google/ExoPlayer#10762

This ensure that ffmpeg error code are properly translated to values that the ExoPlayer decoder understand.
The main gain is that it allows the decoder to properly ignore more cases of invalid data and recover.
The second gain is that the other errors are now proper ExoPlayer errors and no more obscure buffer ones.

Fixes: Issue: google/ExoPlayer#10760
Merge 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a into 972e169bd85b14848dcae75e34f9e95fe87e1f4b
COPYBARA_INTEGRATE_REVIEW=go/exoghi/10762 from Tolriq:ffmpeg_error_code 82ceeb77d6df71f5ffb0474db66a36fd6eb8e51a
PiperOrigin-RevId: 487189910

(cherry picked from commit 6d2e7a1b5760a05eade18b1a028b3d27f714715c)
2022-11-09 10:53:52 +00:00
Googler
dadf2812ec Add 'Player.getVideoSurfaceSize' that returns the size of the surface
on which the video is rendered.

Design Doc: go/aaos-mu-media-dd

PiperOrigin-RevId: 485884772
2022-11-03 15:50:19 +00:00
rohks
721487a701 Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
(cherry picked from commit 55b82ff8ae491f6bcc7f3901476d2b1571a10005)
2022-10-31 15:53:41 +00:00
bachinger
f06e8ee736 Make adding ad live breaks more robust
This change makes adding ad events in live streams more robust by allowing ad
groups to grow in number of ads if more ad events are received than initially
announced by the SDK.

With the IMA prefetch feature, an AdPod can grow in size in certain conditions
like from initially 2 ads to 4 ads being part of the ad group. With this change,
if an additional ad event arrives while the ad group is still being played,
the ad group is expanded. If the event arrives late and the ad group is already
completed, a new group is created for the remaining ads.

This also covers the case where we join the live stream while an ad is being
played and we missed at least one LOADED event from the SDK. Ads of the group
before the first LOADED event are ignored in such a case.

PiperOrigin-RevId: 484214760
(cherry picked from commit 136addf640e451602163be9e4272d1e27b8ed5b8)
2022-10-27 11:10:10 +00:00
samrobinson
8debe79333 Move AudioProcessor to common.
PiperOrigin-RevId: 483699606
(cherry picked from commit dda17db261758f7211ffa793ee9cc6fea842addb)
2022-10-25 16:40:38 +00:00
Rohit Singh
d2c4f740e9 Merge pull request #10618 from vishnuchilakala:fix/do_not_send_content_complete_if_midroll_skipped
PiperOrigin-RevId: 482481703
(cherry picked from commit a413b478f7c45615d3fc7ebd31cacfc363e8ca31)
2022-10-24 10:51:21 +00:00
bachinger
7cc3f119b1 Add manifest to make gradle build work
PiperOrigin-RevId: 481606248
(cherry picked from commit 325e973ace929efa193b114271d844f20814705a)
2022-10-17 11:33:10 +00:00
rohks
a6f58bdb29 Fix instrumentation tests not working via Gradle
PiperOrigin-RevId: 475560401
(cherry picked from commit 6015f052ba1b21bea4ded5bfc4924dc1c096b07a)
2022-09-20 15:25:38 +00:00
bachinger
b47c7a37ac Add withAvailableAd for server side inserted ad groups
#minor-release

PiperOrigin-RevId: 472714732
(cherry picked from commit 072f376b4839b6d4e71bcd09366695b3b9fc2c02)
2022-09-07 14:01:26 +00:00
bachinger
018ea9a44e Bump IMA SDK version for gradle
PiperOrigin-RevId: 472500789
(cherry picked from commit 60a3ea48b8abf3949a87a2b3bc930ce83cf4ce3f)
2022-09-06 17:43:37 +00:00
Googler
bdba124aa9 Fix 1 ErrorProneStyle finding:
* Non-standard parameter comment; prefer `/* paramName= */ arg`
  (see http://go/bugpattern/ParameterComment)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 472252461
(cherry picked from commit dfdcf76daf7762fd40f593662bbb1f5141db1da7)
2022-09-05 11:54:50 +00:00
rohks
e74584e6a0 Switch incorrectly configured native multidex to legacy
Native multidex can only be used for binaries with minSdkVersion of 21 or higher, but minSdkVersion was specified to 16.

PiperOrigin-RevId: 470003836
(cherry picked from commit 142d1c062c4ed4fba450465588217ae5506fece3)
2022-08-25 16:07:42 +00:00
rohks
2af7d877d7 Replace usage of android_binary with build_test for libraries
`android_binary` is only required when building an application.

PiperOrigin-RevId: 469413752
(cherry picked from commit f01896af156efdafeaef6a5eb13e9d251a2e1d57)
2022-08-23 10:24:29 +00:00
bachinger
f9336663b6 Add device info to CastPlayer
Issue: androidx/media#142
PiperOrigin-RevId: 468666737
(cherry picked from commit d6442f63fa9cb3e5197109d11cadcd482ef5c6a4)
2022-08-19 10:45:11 +00:00
tonihei
d5710d3171 Define CueGroup.EMPTY_TIME_ZERO for convenience
We create an empty CueGroup in many places as default or
where none is needed. Instead, we can define a constant
for this purpose and reuse it.

PiperOrigin-RevId: 467944841
(cherry picked from commit 29208ec1ed4d78fa86af33b81a2b32f3151b9004)
2022-08-16 16:27:56 +00:00
tonihei
770839fe2b Update CMake version for AV1 extension
The specified CMake version doesn't work with the latest
Android Studio releases. Updating to a more recent version
fixes the problem.

Issue: google/ExoPlayer#9933
PiperOrigin-RevId: 467634063
(cherry picked from commit 80b635e7abf3a980b801c49c7975c4963aed7518)
2022-08-15 10:49:44 +00:00
tonihei
ea1e26d9dd Add additional build flags for ffmpeg on "arm64-v8a"
From NDK 23.1.7779620 and above, the arm64-v8a ABI needs additional
build flags to correctly link the ffmpeg libraries.

Issue: google/ExoPlayer#9933
PiperOrigin-RevId: 467161973
(cherry picked from commit 6ea1d0ecf068d866faf2f1c0f4624ae5de872497)
2022-08-12 09:43:22 +00:00
tonihei
5cc23fd972 Add timeout for ad to load.
In some cases, the IMA SDK fails to call the expected loadAd
event to load the next ad to play. This is (potentially) the
only remaining case where playback can get stuck due to missing
calls from IMA as the player doesn't even have a MediaSource at
this stage and is only waiting for IMA to provide the ad URL.

We can reuse the existing adPreloadTimeoutMs that was added for
a similar purpose (when preloading the first ad in the group).
The JavaDoc matches this purpose as well and the default timeout
is appropriate since we expect to get the loadAd call immediately.

Issue: google/ExoPlayer#10510
PiperOrigin-RevId: 466953617
(cherry picked from commit 91fc5c4f3c52c02439d1e65f09fa2d2c1c5fcf05)
2022-08-11 14:59:21 +00:00
Googler
368d28268b Update Leanback library from androidx-platform-dev with build#8803384
TGP: https://fusion2.corp.google.com/presubmit/tap/459592967/OCL:459592967:BASE:464692555:1659412331108:1ed6eb4e/targets

If you need additional help investigating this issue, please consider using g/androidx-discuss to reach the wider Jetpack library owner and client community. For general questions about prebuilt drops, refer to go/androidx/g3_faq

PiperOrigin-RevId: 464852576
(cherry picked from commit a3de13c9a936691113325977924afe242dcbba31)
2022-08-02 19:01:58 +00:00
ibaker
57dbf22bfd Annotate methods that always return this with @CanIgnoreReturnValue
It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
(cherry picked from commit 21cab6124de7b65f1af016cfc260555fa0b6e738)
2022-07-21 16:24:07 +01:00
bachinger
cc5b0e1867 Remove okhttp related proguard rules
Issue: androidx/media#10310
#minor-release
PiperOrigin-RevId: 461889651
(cherry picked from commit 759de7d6120b5cfd4f5198122c1217ab05c0aade)
2022-07-19 15:32:38 +00:00
rohks
1bc316dee1 Add timestamp to CueGroup
`TextRenderer` is updated to output `CueGroup`, which contains the presentation time of the cues, in microseconds.

PiperOrigin-RevId: 456531399
(cherry picked from commit bf11a8a83148f0d68c82cf22a5f978b1e6a5e299)
2022-06-22 17:19:55 +01:00
bachinger
268de237a7 Don't set the tag in CastTimeline
Leaving the media item that has been passed in unchanged, ensures that the
media item in the timeline is equal to the media item that the user has
passed into the player. The value of the tag is the uid of the window,
meaning this is redundant information.

#minor-release

PiperOrigin-RevId: 460542246
(cherry picked from commit 9d87c0db78f899ff05e8a26a3e6b4a9667fa81d2)
2022-07-12 20:41:57 +00:00
bachinger
6abbb49738 Enable onMediaMetadataChanged in CastPlayer
Issue: androidx/media#25
PiperOrigin-RevId: 460476841
(cherry picked from commit d6659e92dfc3b5100bbd79f2d28f296a425a2ac1)
2022-07-12 16:04:45 +00:00
ibaker
4b684b59d3 Group COMMAND_SET_MEDIA_ITEM and COMMAND_CHANGE_MEDIA_ITEMS together
I don't think it's useful to keep these in numerical order, it makes
more sense to keep them grouped into a 'logical' ordering.

#minor-release

PiperOrigin-RevId: 460453464
(cherry picked from commit 1b1e0f890da4de6055491730595f72afdde0811a)
2022-07-12 14:06:27 +00:00
bachinger
05e42ebb07 Use the public MediaItem in the timeline of CastPlayer
The media item needs to be assigned to `Window.mediaItem` in `CastTimeline.setWindow`. For this the `MediaItem` needs to be available in the timeline.

When a `MediaItem` is passed to the `set/addMediaItems` method, we can't yet know the Cast `MediaQueueItem.itemId` that is generated on the device and arrives with an async update of the `RemoteMediaClient` state. Hence in the `CastTimelineTracker`, we need to store the `MediaItem` by Casts's `MediaItem.contentId`. When we then receive the updated queue, we look the media item up by the content ID to augment the `ItemData` that is available in the `CastTimeline`.

Issue: androidx/media#25
Issue: google/ExoPlayer#8212

#minor-release

PiperOrigin-RevId: 460325235
(cherry picked from commit 02e1484ebc14a97829c9f5836333412c01205f57)
2022-07-11 23:22:27 +00:00