Skip to content

Commit

Permalink
Handle VAST_LINEAR_ASSET_MISMATCH
Browse files Browse the repository at this point in the history
This error marks the current ad group as unplayable.

Issue: #3801

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185663472
  • Loading branch information
andrewlewis authored and ojw28 committed Feb 20, 2018
1 parent 1d7e8ef commit 5bd7440
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
([#3584](https://github.com/google/ExoPlayer/issues/3584)).
* Work around loadAd not being called beore the LOADED AdEvent arrives
([#3552](https://github.com/google/ExoPlayer/issues/3552)).
* Handle asset mismatch errors
([#3801](https://github.com/google/ExoPlayer/issues/3801)).
* Add support for playing non-Extractor content MediaSources in
the IMA demo app
([#3676](https://github.com/google/ExoPlayer/issues/3676)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import android.webkit.WebView;
import com.google.ads.interactivemedia.v3.api.Ad;
import com.google.ads.interactivemedia.v3.api.AdDisplayContainer;
import com.google.ads.interactivemedia.v3.api.AdError;
import com.google.ads.interactivemedia.v3.api.AdError.AdErrorCode;
import com.google.ads.interactivemedia.v3.api.AdErrorEvent;
import com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener;
import com.google.ads.interactivemedia.v3.api.AdEvent;
Expand Down Expand Up @@ -580,14 +582,17 @@ public void onAdEvent(AdEvent adEvent) {

@Override
public void onAdError(AdErrorEvent adErrorEvent) {
AdError error = adErrorEvent.getError();
if (DEBUG) {
Log.d(TAG, "onAdError " + adErrorEvent);
Log.d(TAG, "onAdError", error);
}
if (adsManager == null) {
// No ads were loaded, so allow playback to start without any ads.
pendingAdRequestContext = null;
adPlaybackState = new AdPlaybackState();
updateAdPlaybackState();
} else if (isAdGroupLoadError(error)) {
handleAdGroupLoadError();
}
if (pendingAdErrorEvent == null) {
pendingAdErrorEvent = adErrorEvent;
Expand Down Expand Up @@ -1041,4 +1046,9 @@ private static long[] getAdGroupTimesUs(List<Float> cuePoints) {
return adGroupTimesUs;
}

private static boolean isAdGroupLoadError(AdError adError) {
// TODO: Find out what other errors need to be handled (if any), and whether each one relates to
// a single ad, ad group or the whole timeline.
return adError.getErrorCode() == AdErrorCode.VAST_LINEAR_ASSET_MISMATCH;
}
}

0 comments on commit 5bd7440

Please sign in to comment.