Improve DEBUG logging in ImaAdsLoader
Log content progress events, as these are helpful to debug triggering of events based on the content progress. Don't log AD_PROGRESS events as they occur several times per second while ads are playing, and the verbosity makes logs difficult to read. PiperOrigin-RevId: 311077302
This commit is contained in:
parent
ad85990455
commit
3478ef3108
@ -688,7 +688,7 @@ public final class ImaAdsLoader
|
|||||||
@Override
|
@Override
|
||||||
public void onAdEvent(AdEvent adEvent) {
|
public void onAdEvent(AdEvent adEvent) {
|
||||||
AdEventType adEventType = adEvent.getType();
|
AdEventType adEventType = adEvent.getType();
|
||||||
if (DEBUG) {
|
if (DEBUG && adEventType != AdEventType.AD_PROGRESS) {
|
||||||
Log.d(TAG, "onAdEvent: " + adEventType);
|
Log.d(TAG, "onAdEvent: " + adEventType);
|
||||||
}
|
}
|
||||||
if (adsManager == null) {
|
if (adsManager == null) {
|
||||||
@ -733,24 +733,11 @@ public final class ImaAdsLoader
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VideoProgressUpdate getContentProgress() {
|
public VideoProgressUpdate getContentProgress() {
|
||||||
if (player == null) {
|
VideoProgressUpdate videoProgressUpdate = getContentVideoProgressUpdate();
|
||||||
return lastContentProgress;
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "Content progress: " + videoProgressUpdate);
|
||||||
}
|
}
|
||||||
boolean hasContentDuration = contentDurationMs != C.TIME_UNSET;
|
return videoProgressUpdate;
|
||||||
long contentPositionMs;
|
|
||||||
if (pendingContentPositionMs != C.TIME_UNSET) {
|
|
||||||
sentPendingContentPositionMs = true;
|
|
||||||
contentPositionMs = pendingContentPositionMs;
|
|
||||||
} else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) {
|
|
||||||
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
|
|
||||||
contentPositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
|
|
||||||
} else if (imaAdState == IMA_AD_STATE_NONE && !playingAd && hasContentDuration) {
|
|
||||||
contentPositionMs = getContentPeriodPositionMs(player, timeline, period);
|
|
||||||
} else {
|
|
||||||
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
|
||||||
}
|
|
||||||
long contentDurationMs = hasContentDuration ? this.contentDurationMs : IMA_DURATION_UNSET;
|
|
||||||
return new VideoProgressUpdate(contentPositionMs, contentDurationMs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// VideoAdPlayer implementation.
|
// VideoAdPlayer implementation.
|
||||||
@ -1082,6 +1069,27 @@ public final class ImaAdsLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private VideoProgressUpdate getContentVideoProgressUpdate() {
|
||||||
|
if (player == null) {
|
||||||
|
return lastContentProgress;
|
||||||
|
}
|
||||||
|
boolean hasContentDuration = contentDurationMs != C.TIME_UNSET;
|
||||||
|
long contentPositionMs;
|
||||||
|
if (pendingContentPositionMs != C.TIME_UNSET) {
|
||||||
|
sentPendingContentPositionMs = true;
|
||||||
|
contentPositionMs = pendingContentPositionMs;
|
||||||
|
} else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) {
|
||||||
|
long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
|
||||||
|
contentPositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
|
||||||
|
} else if (imaAdState == IMA_AD_STATE_NONE && !playingAd && hasContentDuration) {
|
||||||
|
contentPositionMs = getContentPeriodPositionMs(player, timeline, period);
|
||||||
|
} else {
|
||||||
|
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
|
||||||
|
}
|
||||||
|
long contentDurationMs = hasContentDuration ? this.contentDurationMs : IMA_DURATION_UNSET;
|
||||||
|
return new VideoProgressUpdate(contentPositionMs, contentDurationMs);
|
||||||
|
}
|
||||||
|
|
||||||
private VideoProgressUpdate getAdVideoProgressUpdate() {
|
private VideoProgressUpdate getAdVideoProgressUpdate() {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return lastAdProgress;
|
return lastAdProgress;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user