528 Commits

Author SHA1 Message Date
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
c8ec77ef96 Make MediaSessionConnector use getPlaybackError
It's no longer necessary to stash a reference to the
error yourself. This also correctly handles the case
where setPlayer is called with a player that's already
in an error state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194828387
2018-05-07 06:36:43 +01:00
olly
c68e00e28f Fix crash in CronetEngineWrapper
Cronet now returns an unmodifiable list, so we need to copy it

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194790506
2018-05-07 06:32:59 +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
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
hoangtc
fe32401792 Supports extracting from AMR container format.
Supports extracting data from AMR container format for both narrow and wide
band formats. Also added AmrExtractor as one of the default extractor to be
used in DefaultExtractorsFactory.

GitHub: #2527.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194407507
2018-05-07 06:19:55 +01:00
olly
895ac660a8 Default playClearSamplesWithoutKeys consistently to false
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193942368
2018-05-07 06:03:12 +01:00
andrewlewis
a07471ddef Add player to getMediaDescription
This allows access to the timeline for example.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193900798
2018-05-07 05:54:39 +01:00
andrewlewis
117dd6f33f Mark optional parameters @Nullable
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193530582
2018-05-07 05:39:18 +01:00
olly
d4aceef8a8 Add getPlaybackError to Player/ExoPlayer interface
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193400443
2018-05-07 05:31:37 +01:00
hoangtc
fb5e31d3d6 Simplify logic to handle FLAC files with ID3 header.
LibFlac internally can skip ID3 tags correctly. Therefore, we don't need to keep track of the whole ID3 header section and skip through this section in Java code. We can just set the whole stream to the native library, and it will handle skipping ID3 tags correctly.

The only thing that the Java part need to do is peeking and parsing ID3 tags (if present), in order to populate the track format metadata.

GitHub: #4055.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193327602
2018-05-07 05:30:29 +01:00
olly
e99b8802eb Update translations
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193044028
2018-05-07 05:27:02 +01:00
olly
45ed7c304c Update moe equivalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193016758
2018-05-07 05:25:36 +01:00
Oliver Woodman
d4eb2e5b85 Resync internal/external codebases 2018-04-16 11:36:59 +01:00
hoangtc
0b0868889e Supports FLAC files with high sample rate (176400 and 192000).
Also add testing media to verify FLAC extension can play these sample rates.

Github: #3769.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192783193
2018-04-16 10:51:50 +01:00
andrewlewis
fdbf16ed6d Allow setting the ad media load timeout in ImaAdsLoader
Issue: #3691

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192769801
2018-04-16 10:50:32 +01:00
aquilescanta
10d727e810 Use misc status code string when a Cast status code description is not available
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192609475
2018-04-16 10:36:07 +01:00
andrewlewis
ee8fc74d65 Update IMA to 3.8.5 and Play Services to 12.0.0
Issue: #3911

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192404702
2018-04-16 10:29:23 +01:00
ojw28
d075945487
Merge pull request #3977 from Khang-NT/dev-v2
Remove duplicate code MediaSessionConnector.java
2018-04-11 00:33:31 +01:00
hoangtc
986095a4a3 Support FLAC files with ID3 headers.
Support parsing ID3 tags at the beginning of FLAC files, even though FLAC spec
does not require this.

GitHub: #4055.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192127929
2018-04-11 00:28:35 +01:00
tonihei
66d2b76a6c Remove test max SDK version overrides.
These don't seem to be needed anymore. All tests run without them in gradle
and Blaze.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191867518
2018-04-08 16:39:57 +01:00
tek
26cb32ab6a Migrating to new "android" handler from deprecated "androidlocalizer".
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191788495
2018-04-08 16:39:57 +01:00
tonihei
6b82d1c2bd Add setters to MediaSource factories for custom window tag.
This field (formerly "id") is almost impossible to use so far. Having setters
in the factories allows to specify custom tags for all media sources.

Also added a ExoPlayer.getCurrentTag() method to retrieve the tag of the
currently playing media source in a convenient way.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191738754
2018-04-07 19:12:21 +01:00
olly
cb01b281df Add proguard configuration for Cast extension
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191422866
2018-04-03 15:43:53 +01:00
olly
c861b506a3 OkHttp extension - Improved configuration
- Upgrade to latest version
- Use api dependency, since application code that uses the
  extension more has to use OkHttp directly to make an
  OkHttpClient instance
- Add proguard configuration

Issue #4059

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191422594
2018-04-03 15:42:26 +01:00
olly
82c71378eb Remove unnecessary testInstrumentationRunner lines
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191418665
2018-04-03 15:35:40 +01:00
olly
8b5a34769f Remove unnecessary line from test manifests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191409777
2018-04-03 15:30:40 +01:00
olly
4c69826b9c Actually use IMA proguard configuration (oops!)
Issue: #3723

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191407560
2018-04-03 15:29:01 +01:00
andrewlewis
8d47209a46 Make video playback smoother at the beginning
Video renderers assume that the player position is advancing linearly while in
the started state. MediaCodecVideoRenderer schedules frames for rendering in the
future in the expectation that the player position is advancing.

This assumption is not currently true when using a position from the AudioTrack:
the player position can be fixed for (in the worst case) up to about 100 ms
before it starts increasing. This leads to an effect where the first frame is
rendered then a few other frames are rendered, then there's a pause before
frames start being rendered smoothly.

Work around this issue by checking whether the position has started advancing
before scheduling frames to be rendered in the future.

It might be preferable to make the audio renderer only become ready when its
timestamp can start advancing, but this is likely to be complicated.

Issue: #3841

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190937429
2018-03-29 17:55:01 +01:00
andrewlewis
78ff4af6a7 Clean up AudioProcessor implementations
- Ensure that no memory is used by audio processors that are always inactive, by
  only allocating in flush() if active. If data was already allocated but a
  processor becomes inactive we assume that the allocation may be needed in
  future so do not remove it (e.g., in the case of ResamplingAudioProcessor).
- Make SilenceSkippingAudioProcessor set up its buffers in flush(), and clarify
  that it is always necessary to call flush() if configure() returns true.
- Make reset() reset all state for all processors.
- Use @Nullable state or empty arrays for inactive audio processor buffers.
- Miscellaneous style/consistency cleanup.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190895783
2018-03-29 13:47:19 +01:00
olly
0989f272f2 Fix "FLAC decoder input buffer too small" issue
Issue: #3514

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190752950
2018-03-29 13:32:05 +01:00
tonihei
11dbe6d04b Update Ffmpeg README with supported NDK versions disclaimer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190751660
2018-03-29 13:30:24 +01:00
bachinger
6674f63b8b Omit fast forward and rewind actions when current window is not seekable
Issue: #4001

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189722812
2018-03-28 00:12:21 +01:00
Khang Nguyen
41d8aa8e54 Remove duplicate code MediaSessionConnector.java
Fix updateMediaSessionMetadata() called twice;
2018-03-12 19:48:52 +07:00
andrewlewis
e9f36f06ec Force rendering a frame every 100 ms
Also remove logic for tracking the next output buffer in LibvpxVideoRenderer, as
this allowed many consecutive frames to be rendered that were actually late
after dropping to keyframe. It looks better to show frames at a consistent
100 ms rate.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188144739
2018-03-07 15:32:35 +00:00
bachinger
ae421bb50c Add separate interface RatingCallback to handle user ratings.
To support Google Assistant media apps need to support the action
ACTION_SET_RATING. Before this change developers have to use a QueueEditor for
this which does not have any other mandatory actions required for Assistant.
With this change developers can implement the rating action with the
PlaybackPreparer which they need to implement anyway to support Assistant.

https://developer.android.com/guide/topics/media-apps/interacting-with-assistant.html#transport_controls

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188056722
2018-03-07 15:29:17 +00:00
olly
73048f18c1 Remove "r" from instructions for extension modules
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188038757
2018-03-07 15:24:33 +00:00
jschlag
cc48b5568c handle errors from vpx_codec_control_ calls in vpx_jni
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187872692
2018-03-07 15:16:28 +00:00
olly
73b6b20fa3 Improve decoder retention logic.
1. Allow retaining a decoder without any reconfiguration, in addition
   to retaining with reconfiguration (and not retaining)
2. Fix retention logic for video decoders to take into account changing
   ColorInfo
3. Allow retention of audio decoders when possible

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187500285
2018-03-02 09:27:48 +00:00
tonihei
75c3bfb55c Rename Listener for timeline update to avoid confusion with MediaSourceEventListener.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187313128
2018-03-02 09:21:28 +00:00
hoangtc
fcb796a80c Migrate ExoPlayer Gradle build files.
- Change 'compile' configuration (deprecared) to using 'implementation'
and 'api' configurations instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187311778
2018-03-02 09:20:02 +00:00
tonihei
2f4a3d2e5d Replace ConcatenatingMediaSource with DynamicConcatenatingMediaSource.
The non-dynamic media source has a strict subset of features of the dynamic one and
thus can be replaced.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187299432
2018-03-02 09:16:00 +00:00
tonihei
b2c445776a Allow parallel reuse of media sources.
This is achieved by adding a BaseMediaSource which keeps a reference count of the
number of times the source has been prepared and forwards to the actual implementations
only once, such that only minimal changes are needed for each media source.

Issue:#3498

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187186691
2018-03-02 09:08:28 +00:00
tonihei
b47fb2826b Move extension tests to Robolectric.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187021822
2018-02-27 11:03:50 +00:00
olly
099cc384a8 Move scheduler into its own top level package
The util package is, in practice, for things that are misc enough
to not warrant their own package. If something is deserving of a
package, it's IMO best placed somewhere else (I know you could
argue it's a util, but you could argue that about almost anything
else as well).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187010018
2018-02-26 15:41:18 +00:00
andrewlewis
c4f82514bf Fix ImaAdsMediaSource isTopLevelSource
AdsMediaSource must be top-level. Currently the (deprecated) ImaAdsMediaSource
can't be used because it prepares its contained AdsMediaSource as a child
source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186990882
2018-02-26 15:41:18 +00:00
olly
fba2b46a8b Fix bad @see Javadoc in CastPlayer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186305613
2018-02-20 16:29:55 +00:00
andrewlewis
56c9d023fa Fix content progress updates and position faking
Occasionally the player could transition from playing content to playing an ad
after IMA called playAd. The discontinuity triggered faking the content
position, and the fake position was passed to IMA when content resumed causing
the wrong ad group to be loaded. Fix this by only faking the position if the
player transitions before playAd.

Also fix the calculation of the expected ad group index for a postroll ad, and
wait for the player to transition back from ad to content before passing a
content progress update.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185994229
2018-02-19 13:21:53 +00:00
andrewlewis
6c3b677ddb Catch exceptions in all IMA callbacks
If an exception is thrown in an IMA callback it crashes the process with lots of
logging from WebView (including several stack traces, etc.). This change wraps
ImaAdsLoader code that might throw, skips any remaining ads (as the errors are
not recoverable, in general) and notifies a new load error callback so that the
application can implement its own handling. The intention is to make the loader
robust to unexpected requests from IMA and avoid crashes.

Also handle IMA loading an ad in an ad group that has no available ads. In rare
cases IMA will try to load an ad for which an error was previously notified, so
this drops those load requests allowing playback of the content to continue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185985850
2018-02-19 13:20:15 +00:00
andrewlewis
0291bc5e2d Fix content progress reporting if there is no preroll
If there was no preroll and the pending content position was set before the
first midroll, the pending content position was never cleared so loading the ad
was never triggered.

Only set a pending content position if we know that we need to trigger playing
an ad for the current position and IMA will poll for an ad (because there is a
midroll ad group). Clearing the pending content position happens when IMA pauses
content to play the ad.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185818315
2018-02-16 12:09:03 +00:00