Currently onTimelineChanged doesn't allow to distinguish easily between the
different reasons why it's being called. Especially, finding
out whether a new media source has been prepared or the current source
refreshed dynamically was impossible without tightly coupling the player
operations with the listener.
The new reasons provide this disdinction by either indicating a newly
initialized media source, a dynamic update to an existing timeline
or manifest, or a reset of the player (which usually results in an
empty timeline).
The original onTimelineChanged method without reason is kept in the
DefaultEventListener as deprecated to prevent the need to update all
existing listeners in one go.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176478701
Remove an assertion that there was a call to pause content between two
content -> ad transitions.
Also, only use the player position for resuming an ad on reattaching if the
player is currently playing an ad, in case IMA pauses content before the player
actually transitions to an ad.
Issue: #3430
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176365842
As MediaSource listeners now return the MediaSource in on SourceInfoRefreshed,
we need to make sure that media sources wrapping another source don't just
forward the listener, but also provide a listener wrapper. This allows to
inject the wrapper source instance in the callback.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173653307
Controls are still hidden while playing ads, but if the app pauses the player,
controls will be shown. During ads, the player is not seekable.
When the player enters the background then returns to the foreground, the
content period may not be prepared, so also cache the content window duration.
This means that if the app reenters the foreground while an ad is paused the
time bar can be populated.
Issue: #3303
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171123428
imaPausedInAd could only be true when imaPlayingAd was true, so there are only
three possible states.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170827974
This allows simplified listener implementations as most listeners
will not listen to all possible notifications.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170177821
AdsMediaSource lives in the core library so only ImaAdsLoader remains in
the ima extension. AdsMediaSource takes an AdsLoader implementation.
ImaAdsMediaSource is deprecated rather than removed for now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168707921
This allows listeners to easily determine the source of the discontinuity.
Reasons can be period transitions, seeks, and internal reasons.
Listeners still using the deprecated ExoPlayer.EventListener interface were
updated to Player.EventListener.
GitHub: #3252
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168549612
Reporting incorrect positions for ad playbacks was causing IMA to
think the ad wasn't playing, when in fact it was.
Issue: #3180
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167702032
Also mark all ads as played when the postroll plays, in the case the
player is backgrounded then resumed and the user seeks back.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164262738
Multiple timelines work as a wrapper around another timeline and forward
most of the method calls to the wrapped timeline. Added a base class meant to
be overridden which handles all the boiler-plate forwarding.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164117264
Also don't detach any attached player in release() to prevent a possible
NullPointerException if ImaAdsLoader.release() runs first, then the MediaSource
is released and detaches the player. This is safe because if the loader was
attached it's guaranteed to be detached.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163673750
SKIPPED can't be handled as CONTENT_RESUME_REQUESTED because after skipping an
ad there may be further ads to play in its ad group.
Remove workaround for handling unexpected playAd without stopAd, as the player
can instead recover when IMA sends CONTENT_RESUME_REQUESTED. This in turn fixes
handling of the case where playAd is called twice but IMA expects only the
first ad to play, when skipping a particular ad. (Add an ad tag where this
occurs to internal samples.)
Check whether a currently playing ad has been marked as played in
ExoPlayerImplInternal, and handle this case as a seek. This ensures that any
loaded ad periods are discarded in the case of CONTENT_RESUME_REQUESTED.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162610621
Store playWhenReady when playAd is called, and restore it if necessary when the
content resumes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162471616
Remove assertions in pauseAd()/playAd(), which can fail if events are delivered
after detaching the player, and log warnings instead.
Use whether IMA has sent CONTENT_PAUSE_REQUESTED/CONTENT_RESUME_REQUESTED to
determine whether we pause/resume the AdsManager, matching the IMA
documentation.
Also clean up use of player.isPlayingAd vs playingAd.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162364751
adsLoader.contentComplete was called twice which led to postrolls not seeing
the STARTED event.
Also make the onPositionDiscontinuity handler easier to follow by renaming
variables, and remove the adGroupIndex field.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161537765
Once background and resuming is supported, the ads loader will be kept when the
player is destroyed and recreated. Move the state relating to the structure of
ads and what ads have been loaded/played out of the media source and into the
loader so the information is not lost when the source is released, in
preparation for supporting background and resuming.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161503571
This also adds support for seeking in periods with midroll ads.
Remove Timeline.Period.isAd.
Issue: #2617
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160510702
This will allow MediaSources to provide MediaPeriods that correspond to ad
breaks in a timeline period rather than content for a timeline period, in a
future change.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160267841
continueLoading may be called during preparation, but this is not
handled correctly in the case where a deferred period doesn't
have a source yet.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158696539