Do not send content complete if any midroll is skipped

This commit is contained in:
Vishnu Chilakala 2022-09-14 13:44:29 +05:30
parent ab4d37f499
commit b9b30c4669

View File

@ -1122,12 +1122,17 @@ import java.util.Map;
} }
private void ensureSentContentCompleteIfAtEndOfStream() { private void ensureSentContentCompleteIfAtEndOfStream() {
if (!sentContentComplete
&& contentDurationMs != C.TIME_UNSET if (sentContentComplete
&& pendingContentPositionMs == C.TIME_UNSET || contentDurationMs == C.TIME_UNSET
&& getContentPeriodPositionMs(checkNotNull(player), timeline, period) || pendingContentPositionMs != C.TIME_UNSET) {
+ THRESHOLD_END_OF_CONTENT_MS return;
>= contentDurationMs) { }
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(); sendContentComplete();
} }
} }