1561 Commits

Author SHA1 Message Date
bachinger
75513e581f Use Math.round(double) to avoid result being limited to Integer.MAX_INT
Issue: #8067
PiperOrigin-RevId: 337122011
2020-10-17 01:34:24 +01:00
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
andrewlewis
eccc00bca8 Add a way to override ad media MIME types
Issue: #7961
PiperOrigin-RevId: 337069152
2020-10-17 01:34:06 +01:00
andrewlewis
cfe267a568 Encapsulate ImaAdsLoader configuration in a class
This will reduce the amount of boilerplate required to pass the configuration
values around (especially in a planned future change when logic is factored out
of ImaAdsLoader).

PiperOrigin-RevId: 337058355
2020-10-17 01:33:56 +01:00
bachinger
0a9b11d3dd Make resetPosition reset the position if true
Issue: #8024
PiperOrigin-RevId: 335846035
2020-10-13 16:26:41 +01:00
andrewlewis
ac782235ca Fix miscellaneous nits/typos
PiperOrigin-RevId: 335642909
2020-10-06 16:57:31 +00:00
andrewlewis
39277ebe95 Pass ad tags via AdsMediaSource
This is in preparation for supporting playlists of ads media sources using
ImaAdsLoader.

Existing ways of passing ad tags should still function but are deprecated (and
won't be supported with playlists).

Issue: #3750
PiperOrigin-RevId: 335618364
2020-10-06 14:31:50 +01:00
samrobinson
a552e35f6a Add getter and callbacks for static metadata retrieval.
Issue:#7266
PiperOrigin-RevId: 335416280
2020-10-06 14:31:32 +01:00
andrewlewis
41192ee046 Allow apps to add a VideoAdPlayerCallback
Issue: #7944
PiperOrigin-RevId: 335012643
2020-10-06 14:31:23 +01:00
andrewlewis
c35787a08f Add ImaUtil for IMA extension utilities
PiperOrigin-RevId: 334567234
2020-09-30 11:55:52 +01:00
andrewlewis
8728706c6e Use Builder in ImaAdsLoader constructor
PiperOrigin-RevId: 334562209
2020-09-30 11:55:44 +01:00
andrewlewis
151a3d3bf5 Fix position reporting with fetch errors
On receiving a fetch error for an ad that would otherwise play based on an
initial/seek position, the pending content position wasn't cleared which meant
that position reporting was broken after a fetch error. Fix this by always
clearing the pending position (if there was a pending position that will have
triggered the fetch error).

Also deduplicate the code for handling empty ad groups (fetch errors)
and ad group load errors.

Issue: #7956
PiperOrigin-RevId: 334113131
2020-09-30 11:55:09 +01:00
olly
744c57c87d More verbose instructions for consistency
PiperOrigin-RevId: 332015471
2020-09-16 17:00:52 +01:00
aquilescanta
a3cd36beb1 Update the FFmpeg extension readme to use symlinking
PiperOrigin-RevId: 332012857
2020-09-16 16:37:08 +01:00
aquilescanta
b866c5e424 Fix the FFmpeg extension build
Since gradle 4.0, CMake imported libraries are bundled in the APK, so
manually bundling them causes a duplication which breaks the build.

Issue: #7906
PiperOrigin-RevId: 332012375
2020-09-16 16:36:59 +01:00
olly
b999977c9d Dev guide: Copy editing
Also changed the links that describe configuring the
player for ad insertion to link to the ads page.

PiperOrigin-RevId: 331349846
2020-09-13 00:02:32 +01:00
olly
5a009ab476 Remove references to cross-protocol redirects for Cronet
There's no option to enable them. This is probably a copy/paste error
from DefaultHttpDataSourceFactory.

PiperOrigin-RevId: 331334263
2020-09-12 21:05:18 +01:00
olly
bff7ac0dbe Clean up some lint warnings
PiperOrigin-RevId: 331162350
2020-09-11 17:31:03 +01:00
bachinger
99cdf2ca4d MediaItemify the IMA extension README and the ads page in dev guide
PiperOrigin-RevId: 331155539
2020-09-11 17:30:54 +01:00
andrewlewis
156166f57c Fix handling of empty ad groups at non-integer cue points
Issue: #7889
PiperOrigin-RevId: 331149688
2020-09-11 17:30:43 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
andrewlewis
033232784a Improve DEBUG VideoProgressUpdate logging
PiperOrigin-RevId: 330918689
2020-09-11 13:24:22 +01:00
andrewlewis
06de13ecae Add a setter for ad error listeners
This is useful because ImaAdsLoader.getAdsLoader() can now return null
(before ads have been requested), and it avoids the app needing to get
an AdsManager to attach its listener.

PiperOrigin-RevId: 330907051
2020-09-11 13:23:54 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
olly
3110587fbe Fix extension renderer test names + add FfmpegVideo case
PiperOrigin-RevId: 330409635
2020-09-09 09:41:32 +01:00
olly
04f67e4adc Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:43:41 +01:00
olly
8e5336c59e Dev guide: Start updating the download page
PiperOrigin-RevId: 329719402
2020-09-07 20:41:55 +01:00
olly
b79e2e069f SessionPlayerConnector: Use setter for ControlDispatcher
This brings SessionPlayerConnector in line with other
components that use a ControlDispatcher in the ExoPlayer
library, all of which have a setter.

PiperOrigin-RevId: 329665767
2020-09-07 20:41:00 +01:00
andrewlewis
47561f200f Fix handling of incompatible VPAID ads
Issue: #7832
PiperOrigin-RevId: 329497598
2020-09-07 20:40:13 +01:00
gyumin
d155416c54 Add Util.postOrRun
To avoid repetition, it adds Util.postOrRun and replaces existing
instances with the util method.

PiperOrigin-RevId: 329472769
2020-09-07 20:40:04 +01:00
andrewlewis
74c493f51e Add back support for setting audio pitch
To play slow motion streams where the audio has been recorded at
slower speeds, it is necessary to be able to resample (rather than
time-stretch) the audio. This change undeprecates back the previously
deprecated PlaybackParameters class to allow apps to set pitch.

PiperOrigin-RevId: 328703116
2020-08-27 12:06:41 +01:00
jaewan
25c26cdbb4 Return state masked Player values from SessionPlayerConnector
Before this CL, SessionPlayerConnector getters had returned
UNKNOWN_TIME in idle state. It was because
SessionPlayerConnector had followed AndroidX media2
MediaPlayer's behavior, which was the baseline code of the
SessionPlayerConnector.

With this CL, SessionPlayerConnector getters directly return
underlying Player's value, rather than considering calls
in IDLE state as an exception and fallbacks to the default
UNKNOWN_TIME.

PiperOrigin-RevId: 327420940
2020-08-21 12:50:56 +01:00
jaewan
e965ed92f8 Rename DefaultMediaItemProvider to MediaIdMediaItemProvider
PiperOrigin-RevId: 327307736
2020-08-21 12:50:29 +01:00
olly
8c5af10ab0 Don't pass INDEX_UNSET to ExoPlayer seek methods
It's not valid, and will cause IllegalSeekPositionException to be thrown

PiperOrigin-RevId: 327301325
2020-08-21 12:50:20 +01:00
olly
ee743870d8 Media2 extension: Make DefaultMediaItemConverter more useful
- Remove throwing of IllegalStateException
- Make it non-final so additional metadata can be more easily filled in

PiperOrigin-RevId: 327292208
2020-08-21 12:50:11 +01:00
jaewan
bddb29c431 Ban FileMediaItem and CallbackMediaItem
PiperOrigin-RevId: 327268964
2020-08-21 12:50:01 +01:00
jaewan
2299c4e609 Update SessionPlayerConnector documentation
ExoPlayer is now the trusted source of playlist and can be
used by other components without breaking
SessionPlayerConnector's cached playlist.

PiperOrigin-RevId: 327266929
2020-08-21 12:49:52 +01:00
jaewan
4782e227eb Rename androidX MediaItem to media2 MediaItem
In AndroidX, both media1 and media2 have MediaItem classes,
so change the naming to remove ambiguity.

PiperOrigin-RevId: 327261260
2020-08-21 12:49:43 +01:00
jaewan
e6d36e8b92 Add SessionPlayerConnector ctor that use DefaultMediaItemConverter
PiperOrigin-RevId: 327258863
2020-08-21 12:49:34 +01:00
jaewan
b39721f4b5 Make ExoPlayer as the trusted source of playlist
Playlist can now be obtained directly from Timeline windows
in any state. So make ExoPlayer as the trusted source of
playlist, instead of SessionPlayerConnector.

PlayerWrapper still need to keep the list of media items.
It's used to detect whether the Timeline change is caused by
changes in media items or not, and only notify
SessionPlayer.PlayerCallback#onPlaylistChanged() only when
the playlist is really changed.

PiperOrigin-RevId: 327231820
2020-08-21 12:49:25 +01:00
jaewan
be98509e03 Workaround test failure with stable release of media2.session
MediaSession requires prepared Looper in 1.0.3-stable release,
which is the latest stable release for now.

The requirement would be removed in 1.1.0-stable, but workaround
is needed meanwhile.

PiperOrigin-RevId: 327220042
2020-08-21 12:48:57 +01:00
ibaker
f0ae8afd80 Separate the dump files from the test assets
This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
2020-08-17 16:13:53 +01:00
olly
49bf83a169 Media2: Remove MediaSourceFactory + DataSourceCallback
- Applications should generally use DefaultMediaSourceFactory,
  or their own custom implementation if they need one. Having the
  media2 extension implement its own version directly doesn't seem
  that useful.
- Remove support for CallbackMediaItem. This type of MediaItem
  doesn't go cross-process, and it seems like there would never
  be a use case where an app would need to generate one locally.
  If an app needs to provide data from a custom source, it should
  hook into ExoPlayer's way of doing this (i.e., use a UriMediaItem
  with a custom scheme, and inject a custom DataSource that can
  handle this scheme).

PiperOrigin-RevId: 326914465
2020-08-17 16:13:34 +01:00
olly
42cf213aea Media2 tests: Simplify code
- Use ExoPlayer DataSource instrumentation to intercept reads
- Use ExoPlayer Resource URIs
- Use ExoPlayer DefaultMediaSourceFactory

PiperOrigin-RevId: 326912324
2020-08-17 16:13:25 +01:00
jaewan
c2ac33af1b Clean up PlayerWrapper exception log
PlayerWrapper throws Exception if getters is called in the
STATE_IDLE. In that case, log may print 50+ lines of stack
traces. It's verbose and can be considered as serious issue.

This CL include folloing changes
  - Change to use ExoPlayer's log class
  - Adjust log level, because it would be consumed by caller
  - Leave log when the debug flag is turned on.

Another CL will remove exceptions between PlayerWrapper and
and SessionPlayerConnector, not to use Exception for ordinary
control flow as the Effective Java suggests.

PiperOrigin-RevId: 326614559
2020-08-17 16:12:48 +01:00
olly
cdf07f1745 Media2 tests: Clean up assets
Even after this change, it's unclear to me why we need so many
assets for these tests. Just doing a minimal pass for now though!

PiperOrigin-RevId: 326613941
2020-08-17 16:12:39 +01:00
jaewan
e6bf7bd0ff Migrate to use Player's top level playlist API
Being specific, this includes following changes
  - Remove PlaylistManager and TimelinePlaylistManager
    and use Player's playlist API directly.
  - Replace ConcatenatingMediaSource uses with
    ExoPlayer MediaItem.
  - Replace PlaybackPreparer uses with Player#prepare()
  - Add MediaItemConverter for developers to customize
    converting AndroidX MediaItems to ExoPlayer MediaItems
    and vice-versa.
  - Add DefaultMediaItemConverter for providing default
    implementation of both MediaItemConverter
    and MediaSourceFactory.

Note that removing PlaylistManager loses the ability
to suppress individual playlist API. But decided to remove
for simpler API set. The feature can be added back later
via explicit request.

PiperOrigin-RevId: 326463492
2020-08-17 16:12:21 +01:00
ibaker
da4d55635c Create a DumpFileAsserts from the dumpfile logic in FakeExtractorOutput
Also use it to replace the same logic in CapturingAudioSink

PiperOrigin-RevId: 325969455
2020-08-17 16:08:24 +01:00
tonihei
ad346fbdbe Fix FfmpegVideoRenderer tag
PiperOrigin-RevId: 325857202
2020-08-17 16:08:06 +01:00
andrewlewis
acc8453628 Add support for audio-only ad display containers
Issue: #7689
PiperOrigin-RevId: 325752377
2020-08-17 16:05:56 +01:00