138 Commits

Author SHA1 Message Date
andrewlewis
9e122cbaf9 Use non-deprecated AdsMediaSource constructor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195468987
2018-05-07 07:09:41 +01:00
olly
0edc832d67 Get all track key objects into a consistent state
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195421908
2018-05-07 07:07:27 +01:00
olly
bef4a20c31 Move DownloadManager initialization into the application
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195317847
2018-05-07 06:57:19 +01:00
olly
c5bf7f4513 Further clean up DownloadActions + DownloadActivity
- Made parts of DownloadActions public that were previously hidden.
  This is necessary so that when an app is listening to the
  DownloadManager, it can tell something about the tasks.
- Simplified DownloadActivity some more. The helpers may migrate
  into their corresponding modules at some point, and also be
  converted to return structured TrackGroupArrays rather than a
  flat list of Formats.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195269824
2018-05-07 06:53:59 +01:00
olly
b23eabd939 Add error and buffering views to PlayerView
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195203362
2018-05-07 06:49:47 +01:00
olly
c466fabb1c Use integers for HLS rendition keys
Currently it's possible to copy a master playlist with a URL
that was never present in the original. This change prevents
this, and also moves the key more in line with DASH/SS.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195065286
2018-05-07 06:47:40 +01:00
tonihei
ddeafa4fef Remove ad events from analytics listener and collector.
Ad load errors will be forwarded as media source load errors in the future
and other ad events are not actually player related to warrant reporting
them as part of playback analytics.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194936656
2018-05-07 06:44:27 +01:00
olly
175a0100d0 Remove ability to query Downloader implementations
This was adding a lot of code, and the multiple use cases
for Downloader was pretty confusing (in particular the
ordering of method calls was unclear). It's also not
performant (e.g. it requires loading/parsing manifest(s)
and initialization segments from disk).

In practice I think apps will need to keep a record of
what's offlined in their app's database (or equivalent),
which they can update by registering as a listener on
DownloadManager. This will be done for the demo app in
a subsequent change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194932876
2018-05-07 06:43:25 +01:00
olly
59c620c23c Clean up offline notifications
- It's much cleaner to split completed/error notification methods.
- Make error notification show the content title in the demo app.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194920507
2018-05-07 06:41:12 +01:00
andrewlewis
5d3c080f06 Fix NPE on tapping download notification
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194902748
2018-05-07 06:40:09 +01:00
andrewlewis
880ce3f59a Add content intent for download notifications
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194882787
2018-05-07 06:38:50 +01:00
olly
7723f5bdf1 Clean up offline class names
This change is intended to resolve overloading of "Download",
where a DownloadTask could be an actual download task, or a
remove task.

Also cleaned up some documentation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194815058
2018-05-07 06:34:16 +01:00
olly
c6bedc6a85 Improve scheduling
- Redefine Scheduler interface to better describe what implementations
  do. The previous version was too general, in that it allowed concrete
  DownloadService implementations to pass different Requirements to
  the base class and to the Scheduler. It's also difficult to see how
  that version could ever support dynamic updates to Requirements, which
  is probably a feature we'll need to add quite soon.
- Fix a (probably theoretical) problem where static fields in
  DownloadService assumed only a single concrete implementation.
- Stop using PlatformScheduler pre-API-21 in demo app, because it will
  fail.
- Define default Requirements that require network.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194785751
2018-05-07 06:31:28 +01:00
tonihei
d1fdc518fb Use AnalyticsListener in EventLogger.
This replaces the existing listeners and provides some additional meta data
for each event.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194770421
2018-05-07 06:27:52 +01:00
olly
c0fdbde903 Fix permissions lint errors.
- Add ACCESS_NETWORK_STATE to core library. It seems fairly fundamental. We should
  also be using it elsewhere (e.g. to fail fast if there's no network).
- Add annotation to force apps using PlatformScheduler to declare RECEIVE_BOOT_PERMISSION

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194763051
2018-05-07 06:26:46 +01:00
olly
9c15c63d4e Add util method for starting foreground services
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194761771
2018-05-07 06:25:40 +01:00
olly
3e76464666 Fix download percentage reporting
- When calculating the downloaded percentage in DASH, there was no
  way to disambiguate between 0 of 0 segments being downloaded because
  there are no cached indexes (i.e. 0% downloaded) and 0 of 0 segments
  being downloaded because the index defines 0 segments (i.e. 100%
  downloaded).
- Also replace use of NaN with a named constant.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194453202
2018-05-07 06:20:59 +01:00
olly
6ac252843e Move TrackSelectionHelper to UI module
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194373357
2018-05-07 06:17:46 +01:00
olly
0d9d1998f4 Centralize manifest filtering.
The generic type for track key will go away soon.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194220450
2018-05-07 06:14:25 +01:00
olly
b6f646ed96 Clean up DownloadAction instances
This removes a fair chunk of code. The line delta would
be more negative if it not for adding all the /* x= */
comments in DashDownloadActionTest!

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194136689
2018-05-07 06:11:49 +01:00
olly
c9bb102f93 Use Uri rather than string for ProgressiveDownloadAction
This makes it consistent with the other download types.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194089486
2018-05-07 06:10:44 +01:00
olly
1f3adacac3 Use parcelable keys for HLS downloads to remove special casing
This removes the need for separate String/Parcelable filter paths in
the demo app. Hopefully this is a temporary measure as we work
toward using track groups + consistent keys for all media types.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194065499
2018-05-07 06:08:34 +01:00
olly
f96f053f2e Reinstate non-static useExtensionRenderers method
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193970940
2018-05-07 06:06:19 +01:00
andrewlewis
ddd603a1ee Add DownloadService constructor for notification channel
Also move NotificationUtil from the UI module to the core module.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193941401
2018-05-07 06:02:07 +01:00
olly
79c105be59 Clean up naming of demo app download components
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193940323
2018-05-07 06:01:05 +01:00
olly
adc77fd0b1 Simplify & clean up offline support in demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193938140
2018-05-07 05:58:59 +01:00
olly
7d6b0e1fda Move renderer flags, overrides and tunneling ID into Parameters
- This is needed to make DefaultTrackSelector properly thread
  safe, and enable atomic changes to the selector that, for
  example, disable a renderer and enable another one at the same
  time.

- This change also saves/restores parameters and the start
  position in PlayerActivity, resolving the ref'd issue.

Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193913350
2018-05-07 05:56:48 +01:00
olly
d3cdf52591 Sanitize MappedTrackInfo API
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193897041
2018-05-07 05:53:05 +01:00
olly
503a911a77 Use correct IntDef
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193651020
2018-05-07 05:43:46 +01:00
eguven
f4ade38ae4 Add ability to download not DRM protected content to the demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193554024
2018-05-07 05:40:30 +01:00
olly
fec7d32836 Remove TrackSelection.Factory from SelectionOverride
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193045534
2018-05-07 05:28:06 +01:00
olly
1944ebb463 Move random adaptation to an intent extra.
This will help with removing selection factories from
SelectionOverride. It doesn't seem worth the effort to
have this togglable and in the UI of our demo app.

This change will also:

- Help to move TrackSelectionHelper into the UI module,
  since it removes the part that's obviously debug-only.
- Make it possible to specify the ABR algorithm for each
  sample, which might be nice as we start implementing
  more of them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192760196
2018-04-16 10:49:12 +01:00
olly
67cde97a70 Move code unrelated to mapping to DefaultTrackSelector
Issue: #3915

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192759210
2018-04-16 10:47:55 +01:00
aquilescanta
7d0067e298 Fix external storage read permissions bug
Fix bug which causes the PlayerActivity to finish whenever the
android.permission.READ_EXTERNAL_STORAGE permission is requested.

A better solution would involve not requesting permissions if a
previous request is still pending. This would involve keeping
extra state in the activity, so this solution is used to keep
the demo app's complexity at a minimum.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192588821
2018-04-16 10:33:27 +01:00
olly
03a36ce6ba Fix NPE cause by demo app adding null listener to drm manager
Also added an assertion to the DRM event dispatcher to cause
immediate failure when this happens. This is consistent with
the assertion in the equivalent MediaSource class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191892735
2018-04-08 16:39:57 +01:00
olly
fa1856942b Add proguard configuration for Cast demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191442704
2018-04-03 18:49:21 +01:00
olly
62aea5857c Remove view index adjustment for retry button (which no longer exists)
Issue: #4059

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191414566
2018-04-03 15:33:59 +01:00
danarapagna
6380f26a7f Temp fix for b/77315136: Don't lock or check cache directories in SimpleCache
To be immediately rolled back after submission

Submitting on behalf of cblay.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191128111
2018-04-03 15:27:26 +01:00
eguven
e12f890dee Fix NPE in PlayerActivity while playing a playlist
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190787884
2018-03-29 13:42:14 +01:00
tonihei
db475fea86 Add back accidentally deleted parameter in PlayerActivity.
A merge error in a previous change removed the drmSessionManager from
the player factory call.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190769364
2018-03-29 13:37:14 +01:00
tonihei
e228947831 Check for failure cases in demo app before instantiating player and source.
Doing that in the current order may result in cases where we have a player
instance but a null media source and thus the next call to initializePlayer
will fail.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190765633
2018-03-29 13:33:48 +01:00
tonihei
3cbe91a3b0 Pass DrmSessionManager through SimpleExoPlayer.
This will allow SimpleExoPlayer to auto-register its own listener before the
drm session manager is used to set-up the renderers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190478174
2018-03-28 00:43:07 +01:00
tonihei
40947d52f0 Support multiple DefaultDrmSessionManager listeners.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190236842
2018-03-28 00:34:25 +01:00
eguven
522f8c8a99 Make demo app play content from download cache
It's inserted before HttpDataSource as read only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189815245
2018-03-28 00:22:15 +01:00
eguven
764d18f68f Add ability to play filtered manifests in PlayerActivity
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189796293
2018-03-28 00:20:27 +01:00
tonihei
e3a90a44b7 Support media source events for composite media sources.
This is achieved by automatically registering a listener for child sources in
compositions. The composite media source has the chance to correct the
reported window index and media period id in the MediaLoadData of the events.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189575414
2018-03-28 00:06:58 +01:00
olly
0b182d1849 Remove versions from IMA demo manifest that are now specified via gradle
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189000217
2018-03-27 23:44:38 +01:00
aquilescanta
18b1ec7a2f Recreate the cast media queue whenever the timeline is cleared
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188871914
2018-03-13 15:42:24 +00:00
olly
0e756b0e71 Centralize version and target sdk constants
We had these specified directly in AndroidManifest.xml due to
our internal build setup. This change makes our internal build
re-write AndroidManifest.xml to dynamically insert the required
values, meaning they no longer need specifying in each manifest.

Bonus 1: Internally built demo apps now include the CL number at
which they're built in the version name :).

Bonus 2: Removes lint warning that complains min/target SDK
values in the manifest are redundant.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188489115
2018-03-12 15:20:51 +00:00
tonihei
8f952162ff Allow multiple media source event listeners.
This is achieved by moving the listener registration and the creation of the
event dispatcher into BaseMediaSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188461932
2018-03-12 15:15:34 +00:00