420 Commits

Author SHA1 Message Date
ibaker
2f19b63ca0 Add package-info files to packages that only exist in tests
This doesn't affect the nullness checker or Kotlin, but it does make
weird warnings appear in Android Studio. It seems mildly preferable to
have the same spurious warnings in these files that we have in other
tests, rather than different spurious warnings.

PiperOrigin-RevId: 321173760
2020-07-24 10:34:12 +01:00
ibaker
e9a8335381 Migrate callers to pass MediaItem to createMediaSource()
createMediaSource(Uri) is deprecated.

PiperOrigin-RevId: 321121383
2020-07-24 10:31:22 +01:00
olly
21e56f571d Misc analysis fixes
PiperOrigin-RevId: 320921457
2020-07-13 14:04:29 +01:00
aquilescanta
968a0baa8d Fix handling of intents with no license server URI
PiperOrigin-RevId: 319497156
2020-07-03 15:31:20 +01:00
olly
5be6eaa88c Make GL demo easier to understand
PiperOrigin-RevId: 319007693
2020-07-03 09:00:28 +01:00
olly
314bc65d62 Enable download parallelisation in demo app
- Deprecate constructors that don't take an executor, to direct
  developers toward the new ones. Callers can trivially pass
  Runnable::run to one of the new ones if they want old behaviour.
- Add comment explaining warning suppression added in the CL that
  added parallelised download support.

Issue: #5978
PiperOrigin-RevId: 318803296
2020-06-29 14:38:51 +01:00
insun
d5f029315c Cleanup deprecated SimpleExoPlayerView and PlaybackControlView
PiperOrigin-RevId: 318152038
2020-06-26 11:14:13 +01:00
ibaker
06c17f5152 Redefine numeric Cue.line in terms of viewport lines, ignore lineAnchor
Numerical lines conceptually map to a grid of lines in the viewport,
with the Cue text lines being aligned to one of the viewport lines.

It doesn't make sense to position a single-line cue differently based
on lineAnchor when it's expected to 'snap' to a particular line on the
viewport grid. So we redefine the position to be in terms of the cue
lines rather than the bounds of the cue box.

It's also not possible to always handle ANCHOR_TYPE_MIDDLE when
lineType=NUMBER (as it relies on the number of lines in the cue being
odd), so it's easier to ignore lineAnchor completely.
PiperOrigin-RevId: 318034664
2020-06-26 11:13:33 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
andrewlewis
aec5ff8be1 Fix incorrect rounding of ad cue points
We currently get float ad cue points from IMA, but store these as
longs in microseconds. The cast from double to long would take the
floor of the value, which could lead to stored ad cue points being
off-by-one. Use Math.round to avoid this.

ImaAdsLoader also has code to map a double AdPodInfo position (which
should match a cue point) onto the corresponding ad group index by
searching the long ad cue points. Match the calculation used where we
map float cue points, including narrowing the position to a float
first to avoid regressions if IMA SDK behavior changes to represent
positions in more than float precision later, and also remove the
requirement that the ad positions match exactly as a defensive
measure.

PiperOrigin-RevId: 317607017
2020-06-23 11:06:49 +01:00
Oliver Woodman
2fcd759edb Merge pull request #7479 from sravan1213:dev-v2
PiperOrigin-RevId: 315794031
2020-06-11 10:11:30 +01:00
sravan1213
c3282c9a37 Propagate download exception through onDownloadChanged callback 2020-06-08 18:51:54 +05:30
andrewlewis
c13be44f68 Add one hour on-demand test video
PiperOrigin-RevId: 314100932
2020-06-01 14:59:56 +01:00
andrewlewis
eddc2b0b33 Enable multidex for demos
This is necessary now we have Guava in debug (no-minified) apps.

Also switch to AndroidX multidex to remove the support library dependency.
Temporarily we need to add an Application class, as internal jetification
doesn't seem to handle declaring MultiDexApplication in AndroidManifest.xml.

issue:#7421
PiperOrigin-RevId: 313145023
2020-05-27 18:59:43 +01:00
olly
03d9375872 Fix demo app persistent sample selection
It currently crashes if the samples change such that the persisted
position is no longer within bounds.

PiperOrigin-RevId: 312554337
2020-05-21 17:09:32 +01:00
olly
f38a1015ae Adding instructions on how to build and run ExoPlayer demo apps
Issue:#7338
PiperOrigin-RevId: 312470913
2020-05-21 17:08:53 +01:00
bachinger
d233c04582 Simplify DownloadHelper
PiperOrigin-RevId: 312467496
2020-05-21 17:08:43 +01:00
olly
b9abe2d0d6 Clean up samples list
- Add Widevine AV1 streams
- Remove SD and HD only Widevine streams (we don't need so many!)
- Simplify naming

PiperOrigin-RevId: 311697741
2020-05-15 10:59:07 +01:00
bachinger
fefb2a03c2 Provide a constructor that does not require a context
The only reason to require a context for creating an instance of
DefaultMediaSourceFactory is creating a user agent. DownloadHelper
has a bunch of static methods that need to instantiate a
DefaultMediaSourceFactory without a Context. By adding a setter for
the user agent we can remove that restriction and use a default user
agent.

PiperOrigin-RevId: 311291603
2020-05-14 22:22:42 +01:00
bachinger
66fd81401b Add forceDefaultLicenseUri to MediaItem.DrmConfiguration
ISSUE: #7114
PiperOrigin-RevId: 311115835
2020-05-14 22:21:58 +01:00
bachinger
b22783f895 Rename sourceUri to uri
PiperOrigin-RevId: 308918151
2020-05-01 19:46:04 +01:00
andrewlewis
008d38d832 Reattach player to ads loader on resume
When pausing and resuming a playback using an AdsLoader
it is necessary to call setPlayer again. This fixes an
issue where playback was stuck in the buffering state
when pausing and resuming an ad playback in the demo app.

PiperOrigin-RevId: 308582143
2020-04-27 11:34:29 +01:00
bachinger
1323dd63d5 Remove Sample from SampleChooserActivity
Unmarshal from json to MediaItem instead of Sample. Further the playlist
of MediaItems is converted to Intent extras which are read by the
PlayerActivity.

PiperOrigin-RevId: 308141231
2020-04-27 10:41:33 +01:00
olly
4abaaf138c Remove DownloadConstructorHelper
Something that helps a constructor always seemed a bit strange.
It's now possible to use CacheDataSource.Factory directly instead.

PiperOrigin-RevId: 307661930
2020-04-27 10:39:34 +01:00
bachinger
628234fd1f Read media items from intent
PiperOrigin-RevId: 307442976
2020-04-27 10:18:41 +01:00
bachinger
8ea33e2315 Support ad tag with default media source
This is the missing attribute to support all features of the Sample with MediaItem. Hence PlayerActivity can use the setMediaItems() method directly without creating actual media sources in the app code.

PiperOrigin-RevId: 307102036
2020-04-20 13:28:56 +01:00
bachinger
d7280f096f Add custom cache key to media item
This is required to migrate the PlayerActivity away from Sample to MediaItem. It hence needs adding buildUpon to MediaItem to mix in the customCacheKey and streamKeys before playback.

PiperOrigin-RevId: 306710643
2020-04-17 10:44:16 +01:00
olly
a99288a6fa Pass UriSample to DownloadTracker
PiperOrigin-RevId: 306469450
2020-04-15 17:42:18 +01:00
olly
2e51182f53 Update misc dependencies
PiperOrigin-RevId: 305503804
2020-04-08 21:49:03 +01:00
olly
376d02ac3f Upgrade cast dependency
Issue: #7191
PiperOrigin-RevId: 305502293
2020-04-08 21:48:45 +01:00
bachinger
4e2a0f6032 simplify PlayerActivity towards using the media item only
PiperOrigin-RevId: 305300409
2020-04-08 21:47:48 +01:00
olly
8d2bc7d182 Audio focus: Re-request audio focus if in a transient loss state
This avoids cases where audio focus is never successfully acquired
because another app is holding on to transient audio focus indefinitely.

Issue: #7182
PiperOrigin-RevId: 305108528
2020-04-07 13:38:42 +01:00
bachinger
dc4118da7b add clearTrackTypes and playClearContentWithoutKey to DrmConfiguration
With these additional properties, we can declare the behaviour for clear tracks and clear content on a media item level.

PiperOrigin-RevId: 304351716
2020-04-06 13:26:29 +01:00
olly
ce297d40b1 Fix external build
PiperOrigin-RevId: 303757995
2020-03-30 17:35:08 +01:00
bachinger
315ba6f324 add subtitle to the media item
PiperOrigin-RevId: 303753642
2020-03-30 17:17:44 +01:00
olly
e90fdf36fb Handle orientation changes in GL demo
Issue: #7141
PiperOrigin-RevId: 303334072
2020-03-27 23:32:58 +00:00
bachinger
777d99da8a simplify PlayerManager
PiperOrigin-RevId: 303170259
2020-03-27 23:31:29 +00:00
bachinger
d0fc83ed8a Playlist API: move media item based API to Player
This moves the playlist API methods to the Player interface. Implementation is moved from ExoPlayerImpl to BasePlayer where possible.

Further the CastPlayer is changed to implement the Player interface. Proper migration of the Playermanager to not use the ConcatenatingMediaSource anymore follows in a separate, future CL.

PiperOrigin-RevId: 302937779
2020-03-27 23:30:46 +00:00
olly
c3cbccbbf8 Update Activity and fragment libraries from aosp-androidx-master-dev with build id #6325864(2020-03-23) to google3
LSC doc: go/android-sdk-lsc , go/androidx-lsc

Global presubmit: https://tap.corp.google.com/ui#id=OCL:300623192:BASE:302596264:1585028366422:76f628fd

PiperOrigin-RevId: 302749181
2020-03-25 13:05:50 +00:00
olly
af00d91f79 Request storage permission if missing
PiperOrigin-RevId: 302345647
2020-03-25 13:02:36 +00:00
aquilescanta
aa9eb5abc9 Remove generics from DRM components
PiperOrigin-RevId: 301798563
2020-03-20 12:48:50 +00:00
bachinger
510f5edd1d Remove cast media item
PiperOrigin-RevId: 301224632
2020-03-19 00:48:22 +00:00
olly
0d230d517a Miscellaneous cleanup related to recent changes
PiperOrigin-RevId: 300067561
2020-03-11 16:26:41 +00:00
bachinger
a5f0eb1e10 replace extension with mime type
This change uses mime types in a functionally equivalent way to how we used the extension hint so far.

Using a mimeType instead of the extension has some advantages. Most importantly mimeTypes are used by the cast SDK with which we want to achieve interoperability in the cast extension.

Using a mimeType instead of the extension hint further appears to be a bit more clear (which might be opinionated). Further mime types are a well known and widely used concept to identify file type on the internet and it provides asterix based generalizations (audio/*, */*) which could express the media type OTHER that ExoPlayer is using internally (no usage of asterix required so far though).

PiperOrigin-RevId: 300058945
2020-03-11 16:26:23 +00:00
bachinger
041a0696b7 remove UriBundle
PiperOrigin-RevId: 299361095
2020-03-10 10:20:47 +00:00
krocard
1f4156ce6d Restore the demo list position on start
It's quite anoying to have to search in the list
the last item played everytime the demo is restarted.

Fix that by saving and restoring it.

PiperOrigin-RevId: 299109261
2020-03-10 10:19:53 +00:00
bachinger
4517829610 add DefaultMediaSourceFactory and use it in PlayerActivity
PiperOrigin-RevId: 298879027
2020-03-10 10:19:27 +00:00
bachinger
d1bbd3507a add media item to create media sources
This change adds the createMediaSource(MediaItem mediaItem) method to the MediaSourceFactory interface. It doesn't deprecate createMediaSource(Uri uri) to keep the cl smaller. Deprecation and removing calls to the deprecated method from within the library and extension follow in a separate CL.

PiperOrigin-RevId: 298352442
2020-03-10 10:17:03 +00:00
olly
c6a6e0d6f3 Migrate various call sites to Format.Builder
PiperOrigin-RevId: 297562889
2020-02-27 17:15:34 +00:00
olly
7e6a1418e3 Demo apps: Annotate @NonNull where necessary
Because we now annotate not-null by default in ExoPlayer
library modules, we're seeing warnings in the demo apps where
we override a method and don't explicitly specify an equivalent
@NotNull annotation.

It's probably confusing to use not-null by default for the
demo apps, so this change uses @NonNull where necessary to fix
the warnings.

PiperOrigin-RevId: 296000044
2020-02-25 21:21:54 +00:00