380 Commits

Author SHA1 Message Date
ibaker
32fd374405 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 17:08:17 +00:00
ibaker
ecea2b9e90 Rollback of e705999cf3
*** Original commit ***

Rollback of 57182ac7bd

*** 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
274f3a13a2 Rollback of 57182ac7bd32db54d11fd41e21338a2bbfaf043c
*** 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
57182ac7bd 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 12:16:55 +01:00
ibaker
b9f1cb4b15 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 11:02:32 +01:00
christosts
02d847f451 Misc fix on parameter comment
PiperOrigin-RevId: 446181877
2022-05-03 14:48:16 +01:00
ibaker
1809a0b9f9 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 12:00:38 +01:00
bachinger
4c2ea75c66 Fix incorrect JavaDoc
PiperOrigin-RevId: 444874326
2022-05-09 10:33:55 +01:00
olly
0ad508b14f 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:59:00 +01:00
olly
72846c4ff9 Decrease polling rate for IMA Video Ads from 100ms to 200ms
PiperOrigin-RevId: 438634901
2022-04-07 16:11:13 +01:00
bachinger
3cc1d06b6e Remove rounding errors of ad durations when converting from double
#minor-release

PiperOrigin-RevId: 435360232
2022-03-17 16:02:00 +00:00
olly
22159673bd Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-15 00:29:14 +00:00
bachinger
e044235421 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:40:43 +00:00
bachinger
da00f0c6a9 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 10:04:04 +00:00
bachinger
e296bf9197 Clear ad playback state map when AdsLoader is released
#minor-release

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

#minor-release

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

PiperOrigin-RevId: 429006934
2022-02-17 14:24:02 +00:00
bachinger
1fcb4e8b0e Store ad playback state in AdsLoader for resume after backgrounding
#minor-release

PiperOrigin-RevId: 428763656
2022-02-17 14:24:02 +00:00
bachinger
0619a96fa2 Disable IMA SSAI DASH live streams for now
#minor-release

PiperOrigin-RevId: 428761508
2022-02-17 14:24:02 +00:00
bachinger
de3708ee12 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 14:24:02 +00:00
bachinger
13db1e739e 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 14:23:57 +00:00
bachinger
b15c5634e6 Make AdsLoader.addMediaSourceResources package private.
#minor-release

PiperOrigin-RevId: 428565444
2022-02-17 11:57:54 +00:00
bachinger
1e66483b3e 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 11:37:38 +00:00
bachinger
a7b0202712 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 11:16:56 +00:00
tonihei
1e2345cffe 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:07:01 +00:00
tonihei
17050e8b59 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 12:34:06 +00:00
olly
2db8807aac Revert of b19ced30c4c2853b09af3382b86f84c31b3a5af5
PiperOrigin-RevId: 426996878
2022-02-08 12:33:53 +00:00
ibaker
b19ced30c4 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 11:17:31 +00:00
ibaker
0c2e77daca 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 15:07:19 +00:00
ibaker
6a269baeed 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:49:52 +00:00
bachinger
b911e2ee4e Mark played ads in multi-period VOD streams
#minor-release

PiperOrigin-RevId: 425842813
2022-02-04 09:30:57 +00:00
ibaker
4020f69596 Publish the ImaServerSideAdInsertionMediaSource
Issue: google/ExoPlayer#8213

#minor-release

PiperOrigin-RevId: 425381474
2022-02-02 10:04:32 +00:00
bachinger
bdd64ce6a1 Setup VOD cue points to fill them when loaded
This makes sure the number of ads in an ad group matches to the number of periods representing an ad group in a multi-period timeline. This makes it easier to accurately mark ads as played in multi-period windows which is needed to correctly prevent seeking over unplayed ads.

PiperOrigin-RevId: 425317085
2022-02-01 14:26:06 +00:00
olly
5d7641c6f1 Fix some lint warnings
PiperOrigin-RevId: 424383900
2022-01-28 09:37:06 +00:00
ibaker
ba58be2c41 Add an anchor tag for the IMA compat URL in ImaAdsLoader javadoc
The naked URL is not hyperlinked by the javadoc compiler, meaning a user
is forced to awkwardly copy it into the address bar of their browser:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.html

#minor-release

PiperOrigin-RevId: 422320571
2022-01-17 14:27:04 +00:00
ibaker
5e8d1eb7f3 Add MediaSource.Factory and deprecate MediaSourceFactory
This more closely matches the pattern we have for all implementations
except DefaultMediaSourceFactory (e.g. ProgressiveMediaSource.Factory)
and other factory interfaces like (Http)DataSource.Factory.

PiperOrigin-RevId: 417826803
2022-01-04 12:51:47 +00:00
ibaker
4bf7ffd9a7 Move ImaAdsLoader Player.Listener implementation to internal class
PiperOrigin-RevId: 416613846
2021-12-16 10:17:18 +00:00
bachinger
9316b4f49b Add helper method to split the AdPlaybackState
PiperOrigin-RevId: 416543473
2021-12-16 10:13:45 +00:00
bachinger
a92e48e5f8 Support IMA DAI streams for HLS
PiperOrigin-RevId: 414804513
2021-12-10 16:21:51 +00:00
ibaker
5c2f618613 Migrate usages of Timeline#getPeriodPosition to getPeriodPositionUs
#minor-release

PiperOrigin-RevId: 414671861
2021-12-08 10:01:38 +00:00
olly
12c0aa2ec9 Update dependency versions
Note: Updating androidxTestTruthVersion is required tot
arget API level 31.
PiperOrigin-RevId: 409167744
2021-11-15 10:53:47 +00:00
olly
a9f7b943c8 Prepare for adding ServerSideInsertedAdsMediaSource for IMA
PiperOrigin-RevId: 407274072
2021-11-03 15:16:58 +00:00
ibaker
7de079493c Migrate usages of Window-based Player methods
Where this introduced an inconsistency (e.g. assigning to something
called `windowIndex`), I generally renamed the transitive closure of
identifiers to maintain consistency (meaning this change is quite
large). The exception is code that interacts with Timeline and Window
directly, where sometimes I kept the 'window' nomenclature.

#minor-release

PiperOrigin-RevId: 407040052
2021-11-02 12:08:18 +00:00
olly
8e2083a27b Remove dependency from common tests to exoplayer
PiperOrigin-RevId: 406354526
2021-11-01 09:54:23 +00:00
ibaker
1c824561c6 Migrate callers of deprecated C.java methods to Util.java
#minor-release

PiperOrigin-RevId: 406166670
2021-10-29 11:31:50 +01:00
andrewlewis
0ad1cdbfa1 Tidy READMEs
PiperOrigin-RevId: 405598530
2021-10-26 14:08:21 +01:00
olly
d601875452 Rename releaseArtifact to releaseArtifactId
PiperOrigin-RevId: 404059404
2021-10-18 22:45:47 +01:00
olly
18cf01cda6 Move DataSource utils into a DataSourceUtil class
PiperOrigin-RevId: 403910535
2021-10-18 15:25:43 +01:00
samrobinson
3c19850ed3 Migrate library usages of SimpleExoPlayer to ExoPlayer.
PiperOrigin-RevId: 402853522
2021-10-14 12:03:11 +01:00
krocard
98ee159df1 Use TracksInfo and selection override in users
Update the UI module, the demos and most other users
to make use of the new player TracksInfo and track
selection override APIs.

PiperOrigin-RevId: 402817857
2021-10-14 11:54:45 +01:00