Skip to content

Commit

Permalink
Do not send content complete if any midroll is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnuchilakala committed Oct 18, 2022
1 parent ab4d37f commit b9b30c4
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1122,12 +1122,17 @@ private void handleAdPrepareError(int adGroupIndex, int adIndexInAdGroup, Except
}

private void ensureSentContentCompleteIfAtEndOfStream() {
if (!sentContentComplete
&& contentDurationMs != C.TIME_UNSET
&& pendingContentPositionMs == C.TIME_UNSET
&& getContentPeriodPositionMs(checkNotNull(player), timeline, period)
+ THRESHOLD_END_OF_CONTENT_MS
>= contentDurationMs) {

if (sentContentComplete
|| contentDurationMs == C.TIME_UNSET
|| pendingContentPositionMs != C.TIME_UNSET) {
return;
}

long contentPeriodPositionMs = getContentPeriodPositionMs(checkNotNull(player), timeline, period);
int pendingAdGroupIndex = adPlaybackState.getAdGroupIndexAfterPositionUs(contentPeriodPositionMs, contentDurationMs);
if (!adPlaybackState.getAdGroup(pendingAdGroupIndex).shouldPlayAdGroup()
&& contentPeriodPositionMs + THRESHOLD_END_OF_CONTENT_MS >= contentDurationMs) {
sendContentComplete();
}
}
Expand Down

0 comments on commit b9b30c4

Please sign in to comment.