119 Commits

Author SHA1 Message Date
bachinger
abe11c88ec Clarify what default settings are being used for SSAI AdsLoader
PiperOrigin-RevId: 502388865
2023-01-17 02:11:18 +00:00
bachinger
16285ca5df Add AdsLoader.focusSkipButton()
This method allows to call through to `StreamManager.focus()` of the currently playing SSAI stream.

PiperOrigin-RevId: 501399144
2023-01-17 01:54:45 +00:00
bachinger
9882a20783 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
2023-01-17 01:45:56 +00:00
rohks
578f2de48f 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
2023-01-10 18:33:20 +00:00
bachinger
fc22f89fde Remove player listener on the application thread of the player
PiperOrigin-RevId: 497183220
2023-01-04 21:40:32 +00:00
bachinger
63352e97e9 Bump IMA SDK version to 3.29.0
Issue: google/ExoPlayer#10845
PiperOrigin-RevId: 496947392
2023-01-04 21:29:59 +00:00
ibaker
636a4a8538 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
2022-12-12 11:19:23 +00:00
Rohit Singh
b81d5f304e Merge pull request #10799 from OxygenCobalt:id3v2-multi-value
PiperOrigin-RevId: 491289028
2022-11-29 18:35:59 +00:00
kimvde
1ee185cb10 Refactor transformation completion
PiperOrigin-RevId: 488929446
2022-11-22 09:44:47 +00:00
samrobinson
59aedcf309 Handle buffers in DefaultAudioSink with AudioProcessingPipeline.
PiperOrigin-RevId: 488412695
2022-11-16 12:07:58 +00:00
ibaker
4f04a284ed 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
2022-11-10 14:56:54 +00:00
ibaker
7905744a83 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
2022-11-10 14:42:00 +00:00
bachinger
64e9e88823 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
2022-10-31 11:42:19 +00:00
Rohit Singh
faa4302219 Merge pull request #10618 from vishnuchilakala:fix/do_not_send_content_complete_if_midroll_skipped
PiperOrigin-RevId: 482481703
2022-10-24 10:48:25 +00:00
rohks
c96e010d35 Fix instrumentation tests not working via Gradle
PiperOrigin-RevId: 475560401
2022-09-30 18:03:11 +00:00
bachinger
70e82a29b7 Add withAvailableAd for server side inserted ad groups
#minor-release

PiperOrigin-RevId: 472714732
2022-09-30 17:38:58 +00:00
bachinger
9e1e0a1004 Bump IMA SDK version for gradle
PiperOrigin-RevId: 472500789
2022-09-30 17:35:36 +00:00
rohks
5b3f320230 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
2022-09-30 17:04:29 +00:00
tonihei
b125d45a63 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
2022-09-30 16:32:27 +00:00
ibaker
2deb435625 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
2022-08-08 07:55:25 +00:00
ibaker
3d2b335825 Simplify DefaultMediaSourceFactory instantiation in a test
There's no need to manually construct a 'default'
DefaultDataSource.Factory instance, we can just pass the `Context` to
`DefaultMediaSourceFactory` and let it construct the
`DefaultDataSource.Factory` internally.

PiperOrigin-RevId: 451155747
2022-05-30 16:32:59 +00:00
ibaker
26a1817ebf Rollback of e01bb47263
*** Original commit ***

Rollback of 07302a23bd

*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default imple...

***

PiperOrigin-RevId: 450453325
2022-05-23 17:12:22 +01:00
ibaker
1d139174fd Rollback of 07302a23bd5894d57514c68b2db499ac46726e77
*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450410833
2022-05-23 13:01:22 +01:00
ibaker
07302a23bd Remove @Nullable from MediaSource.Factory setters
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450386627
2022-05-24 11:07:07 +01:00
ibaker
4ce60968b2 Fix warning about ambiguous @EnsuresNonNull annotation
```
[expression.parameter.name.shadows.field] The postcondition
EnsuresNonNull on the declaration of method 'setContentTimeline'
contains ambiguous identifier 'contentTimeline'. Use
"this.contentTimeline" for the field, or "#1" for the formal parameter.
  private void setContentTimeline(Timeline contentTimeline) {
               ^
```

PiperOrigin-RevId: 448285571
2022-05-24 10:42:20 +01:00
christosts
534cfc7968 Misc fix on parameter comment
PiperOrigin-RevId: 446181877
2022-05-09 10:50:31 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
bachinger
1e251b3be7 Fix incorrect JavaDoc
PiperOrigin-RevId: 444874326
2022-05-09 10:22:32 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
olly
7bbcf1c4c1 Decrease polling rate for IMA Video Ads from 100ms to 200ms
PiperOrigin-RevId: 438634901
2022-04-06 11:38:05 +01:00
bachinger
3848595377 Remove rounding errors of ad durations when converting from double
#minor-release

PiperOrigin-RevId: 435360232
2022-03-17 16:02:00 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00
bachinger
e531e788df Transform map of AdsLoader.State to a Bundle
This fixes an exception thrown when parceling becasue the type can not be found
(expects the AdsPlaybackState to be Serializable). Transforming the map and the
ad playback states to a Bundle fixes the problem.

#minor-release

PiperOrigin-RevId: 433491993
2022-03-09 17:37:34 +00:00
bachinger
8e8c59031c Drop ads for which we don't have metadata when joining a live stream
When a live stream is joined while ads are already playing, the LOADED event is
missed and we don't have ad information for those ads in the ad group that are
before the ad index at which we joined. This way we can clip the duration when we
receive the LOADED event for the last ad in the group. This fixes the problem of
the playback controls being hidden when content resumes after the ad group.

#minor-release

PiperOrigin-RevId: 431269627
2022-03-01 09:42:24 +00:00
bachinger
6978746f4f Clear ad playback state map when AdsLoader is released
#minor-release

PiperOrigin-RevId: 429067634
2022-02-17 11:52:24 +00:00
bachinger
0842295a88 Make AdsLoader.State implement Bundleable
This allows the AdsLoader.State to be stored in savedInstanceState

#minor-release

PiperOrigin-RevId: 429057697
2022-02-17 11:52:24 +00:00
bachinger
b8687a3111 Copy playback configuration when creating the content media item
#minor-release

PiperOrigin-RevId: 429006934
2022-02-17 11:52:23 +00:00
bachinger
0db8047756 Store ad playback state in AdsLoader for resume after backgrounding
#minor-release

PiperOrigin-RevId: 428763656
2022-02-17 11:52:23 +00:00
bachinger
b22273de01 Disable IMA SSAI DASH live streams for now
#minor-release

PiperOrigin-RevId: 428761508
2022-02-17 11:52:23 +00:00
bachinger
91d4add082 Prevent adding multiple IMA SSAI media source instances to the playlist
Currently only a single instance of ImaServerSideAdInsertionMediaSource is
supported at the same time in a playlist. This change makes sure that an
attempt to add multiple instances is prevented by throwing a an exception.

#minor-release

PiperOrigin-RevId: 428743140
2022-02-17 11:52:23 +00:00
bachinger
1a31faaeee Reset stream manager in AdsLoader.release()
This prevents a stack trace that is shown in the logs when the stream manager is
released after the activity was stopped. In this case the call to
`streamManager.destroy()` coming from `releaseSourceInternal()` of the media
source is too late and produces an error saying `Application attempted to call on
a destroyed WebView`. The error has no effect but it's nice to not have this
stack trace in the logs.

PiperOrigin-RevId: 428574231
2022-02-17 11:52:17 +00:00
bachinger
741ab34a63 Make AdsLoader.addMediaSourceResources package private.
#minor-release

PiperOrigin-RevId: 428565444
2022-02-17 10:39:15 +00:00
bachinger
6197a712ff Use content timeline to get ad group index and ad index in ad group
The timeline used to map ad groups to periods needs to report the original content period duration without subtracting the serverside inserted ad duration. When marking played ads in onPositionDiscontinuity, the public timeline has been used which crashed the app when the ads media source is playing on a window index different to zero (in a playlist).

#minor-release

PiperOrigin-RevId: 428465833
2022-02-17 10:33:44 +00:00
bachinger
a72f04f9b0 Resolve media period ids in multi-period windows
Ignorable ad periods are skipped to resolve the media period id with the
ad playback state of the resulting period. In case of a change in the period
position un-played ad periods are rolled forward to be played.

PiperOrigin-RevId: 428011116
2022-02-17 10:26:59 +00:00
tonihei
cd3bef24b5 Simplify StreamRequest.Builder to an Uri Builder and make it public
Right now, the option to build an IMA DAI URI programmatically is still
package-private. To simplify the process, we can remove the StreamRequest
wrapper and directly provide an URI builder.

The same class can provide some package-private helper methods to parse the
created URI.

#minor-release

PiperOrigin-RevId: 427445326
2022-02-17 10:06:51 +00:00
tonihei
287182952d Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 11:07:50 +00:00
olly
1f7174e731 Revert of 87420e5f9bd1671cd3068185f7358f5faba53e71
PiperOrigin-RevId: 426996878
2022-02-08 11:07:43 +00:00
ibaker
87420e5f9b Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 10:49:31 +00:00
ibaker
8149ac8922 Mark all non-public IntDefs as only TYPE_USE
This only changes IntDefs that cannot be used by apps because they're
either private or package-private.

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426372273
2022-02-04 14:51:52 +00:00
ibaker
dc6bf507c7 Redefine the SSAI URI format with an "ssai" scheme instead of "imadai"
This allows us to remove the IMA naming from DefaultMediaSourceFactory's
SSAI integration.

#minor-release

PiperOrigin-RevId: 426346456
2022-02-04 14:46:54 +00:00