543 Commits

Author SHA1 Message Date
tonihei
bc9fb8615e Use correct period-window offset for initial prepare position.
MaskingMediaSource needs to resolve the prepare position set for a MaskingPeriod
while the source was still unprepared to the first actual prepare position.

It currently assumes that the period-window offset and the default position is
zero. This assumption is correct when a PlaceholderTimeline is used, but it
may not be true if the real timeline is already known (e.g. when re-preparing
a live stream after a playback error).

Fix this by using the known timeline at the time of the preparation.
Also:
 - Update a test that should have caught this to use lazy re-preparation.
 - Change the demo app code to use the recommended way to restart playback
   after a BehindLiveWindowException.

Issue: #8675
PiperOrigin-RevId: 361604191
2021-03-12 10:40:15 +00:00
Ian Baker
49c282d6fa Merge pull request #8677 from dlafayet:ttml
PiperOrigin-RevId: 361106701
2021-03-12 10:38:59 +00:00
aquilescanta
1c40c75433 Use a debug signature config for demo apps' release variant
PiperOrigin-RevId: 359724874
2021-03-02 17:02:55 +00:00
bachinger
36cbcb30b6 Set explicit export attributes in all demo apps
Starting with Android 12 all components of an app that have an intent filter need to have an explicit attribute android:export that is set to either true or false. If a component filters for the MAIN or a VIEW action it needs the attribute explicitly set to true. Prior to Android 12 these were exported implicitly.

See https://medium.com/androiddevelopers/lets-be-explicit-about-our-intent-filters-c5dbe2dbdce0

PiperOrigin-RevId: 358368785
2021-02-22 10:34:58 +00:00
olly
0dba806894 Move DebugTextViewHelper to core
It's closely tied to SimpleExoPlayer, so cannot be part of a UI module
that depends only on common.

PiperOrigin-RevId: 357085802
2021-02-12 16:40:05 +00:00
olly
ba1ebe7844 Clarify how cookies are handled (or not) in the demo app
1. Remove cookie manager logic from PlayerActivity, since it has
   no effect when Cronet is used (which is now the default)
2. Add toggle in DemoUtil to use Cronet or the default network
   stack. Configure the cookie manager only when using the default
   network stack

PiperOrigin-RevId: 350922671
2021-01-11 18:04:53 +00:00
olly
2a5f6d8f62 Improve user-agent configuration
- Support setting the user-agent in CronetDataSource
- Support setting the default user-agent in CronetEngineWrapper
- Use the underlying network stack's default user-agent by
  default. Many applications will configure the underlying
  CronetEngine or OkHttpClient with a user-agent that they
  expect to be used throughout their app, so always overriding
  this with our own default, on reflection, is not the best
  thing to do!

Issue: #8395
PiperOrigin-RevId: 350921963
2021-01-11 18:04:43 +00:00
olly
686d11de1b Force PlayReady license URL
The media specifies a URL that uses http rather than https, which the
demo app doesn't permit by default. The URL here is the same except it
uses https instead.

#minor-release

PiperOrigin-RevId: 348445571
2020-12-23 22:51:46 +00:00
bachinger
62720858ed Make CronetDataSourceFactory an inner class of CronetDataSource
#exofixit

PiperOrigin-RevId: 348444280
2020-12-23 22:51:38 +00:00
andrewlewis
4446e2637d Fix unexpected multiline comments
#exofixit

PiperOrigin-RevId: 344517105
2020-11-30 09:32:25 +00:00
olly
1d4d5887c0 Clean up demo app samples
- Retire YouTube streams. They're flaky (e.g., one of them has transformed into
  an audio only stream!). There is also a desire for us to stop relying on special
  non-expiring YouTube URLs.
- Reorganize the remaining streams.

PiperOrigin-RevId: 344421031
2020-11-27 11:08:26 +00:00
olly
2fbad2105e Make special exception for cleartext-not-permitted
#exofixit

PiperOrigin-RevId: 344246408
2020-11-27 11:07:07 +00:00
andrewlewis
866c7f85f8 Allow playing ads in playlists
- Remove restriction on `AdsMediaSource`s in playlists in `ExoPlayerImpl`.
- Allow playing playlists of `AdsMediaSource`s in the demo app.
- Add a sample with ads in a playlist in the demo app.

Issue: #3750
PiperOrigin-RevId: 344018774
2020-11-24 16:03:04 +00:00
olly
3981f9f1ae Re-download failed download in demo app
The demo app has two states for downloads, as per DownloadTracker.isDownloaded.
It's either "downloaded or downloading" (isDownloaded returns true, and the UI
shows a blue tick) or it's "not downloaded or failed (isDownloaded returns
false, and the UI does not show a blue tick).

toggleDownload is out of sync in that it treates "failed" as belonging to the
first state rather than the second. This means tapping on the grey tick in the
UI in this case appears to be a no-op (tapping it again will make something
happen).

This change aligns things by making toggleDownload re-download in the case a
previous download failed. In the future we could consider having three states,
so failed downloads could be disambiguated properly. Unclear whether it's a
good complexity/benefit trade-off for the demo app though!

#minor-release

PiperOrigin-RevId: 343464364
2020-11-20 17:09:46 +00:00
olly
622a44dce0 Finish PlayerActivity if cleartext not permitted
This is inline with other show-toast-on-error cases in this method, and avoids
leaving the user on a completely black screen.

Note that the maybeRequestReadExternalStoragePermission is an exception because
it's not actually an error case.

#minor-release

PiperOrigin-RevId: 343264869
2020-11-19 17:12:59 +00:00
christosts
dc86b625c5 Pass drm_key_request_properties in offline DRM downloads
Pass the drm_key_request_properties specified in the json list
when donwloading thee offline Widevide license in the demo app.

PiperOrigin-RevId: 342243441
2020-11-13 14:55:38 +00:00
bachinger
b03df4e8b5 Add dispatchPrepare(player) to ControlDispatcher
Issue: #7882
PiperOrigin-RevId: 341394254
2020-11-11 09:49:32 +00:00
andrewlewis
5fd1601f91 Signal an ads identifier to the AdsLoader
In a later change, the AdPlaybackState will include the playing adsId (set by
the AdsLoader) and the ads loader will use this to determine what ad
information is associated with the playing/next periods, to allow loading ads
in playlists.

Apps can continue to pass just a URI for an ad tag with their MediaItem, in
which case the associated playlist will request that ad tag just and the same
state will be used for all occurrences of the ad tag.

This change has breaking changes to the AdsLoader interface and removes
deprecated ways of passing the ad tag, as it's very likely to go into a major
release anyway and not needing to handle the deprecated cases simplifies
ImaAdsLoader.

Issue: #3750
PiperOrigin-RevId: 340438580
2020-11-06 16:32:31 +00:00
andrewlewis
32a72fa237 Add sample for testing skippable ads in midrolls
#minor-release

PiperOrigin-RevId: 339447845
2020-11-02 22:58:25 +00: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
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
Oliver Woodman
19a0258bac Merge pull request #7798 from yoobi:trackSelectionView
PiperOrigin-RevId: 333751261
2020-09-25 17:49:12 +01:00
ibaker
d3639a2b20 Add Japanese subtitle examples to the demo app
These are from https://medium.com/google-exoplayer/improved-japanese-subtitle-support-7598fee12cf4

PiperOrigin-RevId: 333296789
2020-09-25 16:31:11 +01:00
christosts
7b5b8b2d79 Fix bug in offline DRM downloads
PiperOrigin-RevId: 331955966
2020-09-16 13:34:16 +01:00
olly
bff7ac0dbe Clean up some lint warnings
PiperOrigin-RevId: 331162350
2020-09-11 17:31:03 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +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
fe2fc8b73f Add useful DownloadRequest to MediaItem conversion method
PiperOrigin-RevId: 329722775
2020-09-07 20:42:14 +01:00
insun
3ab9bc8e7f Fix internal demo app crash
Internal demo app crashed when device does not support required DRM scheme.
This CL fixes it.

PiperOrigin-RevId: 329653841
2020-09-07 20:40:41 +01:00
olly
440fd1cf62 Some minor tweaks
1. Add EventLogger right away in PlayerActivity, else it doesn't log
   playWhenReady being initially set to true.
2. Remove EventLogger logging for the audio position advancing. It's
   redundant with isPlaying logging unless you're very specifically
   interested in the timing difference.
3. Remove unnecessary comment in Player.
4. Fix Timeline Javadoc.

PiperOrigin-RevId: 328983944
2020-09-07 20:39:36 +01:00
christosts
603dcf4978 Download offline DRM license from non-UI thread
PiperOrigin-RevId: 328904901
2020-09-07 20:38:48 +01:00
Yo Ob
869981a360
Merge branch 'dev-v2' into trackSelectionView 2020-08-28 11:36:59 +02:00
Yoni Obadia
181676d950 dev: adding sorting for TrackSelectionDialog and TrackSelectionDialogBuilder 2020-08-24 15:13:21 +02:00
olly
7588c26b60 Remove support for cbc1 and cens encryptions schemes
PiperOrigin-RevId: 327199833
2020-08-21 12:48:39 +01:00
aquilescanta
fcb263a407 Make DrmSessionManager take a Format instead of DrmInitData
Skipping acquirePlaceholderSession which will be removed
in a following change.

PiperOrigin-RevId: 326402746
2020-08-17 16:11:17 +01:00
olly
6f7524521b Demo app: Update concatenation terminology to use "playlist"
PiperOrigin-RevId: 326401528
2020-08-17 16:11:08 +01:00
olly
5220c70c5e Demo app: Rename drm_license_url to drm_license_uri
It's quite hard to document drm_force_default_license_uri when the
actual license URI uses "url" terminology. This brings the two in
line.

PiperOrigin-RevId: 326283162
2020-08-17 16:10:22 +01:00
olly
a7b1b56064 Demo app: Remove is_live from exolist.json
It's not used in the public exolist.json file. It's only use is to
disable the download icon for live content, but it's quite easy to
forget (there are live samples in our internal exolist.json files
that omit this property!).

It's better just to show a clear error message toast when the
download actually fails for this reason.

PiperOrigin-RevId: 326281649
2020-08-17 16:10:13 +01:00
olly
a8a32d6bec Demo app: Minor simplifications
- Simplify the ability to use placeholder DRM sessions to a boolean
- Remove unused IS_LIVE entry in the intent

PiperOrigin-RevId: 326280149
2020-08-17 16:10:03 +01:00
andrewlewis
a7a364d567 Remove unused local intent
PiperOrigin-RevId: 326216921
2020-08-17 16:09:28 +01:00
olly
361e5d9326 Demo app: Fix DRM support check for ClearKey
Issue: Issue: #7735
PiperOrigin-RevId: 325900705
2020-08-17 16:08:15 +01:00
olly
805cfb0259 Revert spurious sample update
PiperOrigin-RevId: 325419476
2020-08-07 19:04:28 +01:00
christosts
a5e6e3054d Offline DRM in main demo app
PiperOrigin-RevId: 325413035
2020-08-07 19:04:09 +01:00
olly
b9612bc338 Fix codec initialization data for Opus in MP4
PiperOrigin-RevId: 325327466
2020-08-07 19:03:40 +01:00
olly
be88143fcd Remove deprecated parts of demo app IntentUtil
PiperOrigin-RevId: 324604419
2020-08-07 18:59:11 +01:00
christosts
33fe3a47e3 Remove references to Downloads from IntentUtil
PiperOrigin-RevId: 324599130
2020-08-07 18:59:01 +01:00
christosts
abfe7a2314 Support clip start/end points in demo app
Demo app supports clip start/end points and demonstrates manual
ad insertions.

PiperOrigin-RevId: 324574358
2020-08-07 18:58:41 +01:00
ibaker
132cff1e47 Add an example of tx3g subtitles in an MP4 container
Issue: #7677
PiperOrigin-RevId: 324180797
2020-08-01 12:56:48 +01:00