google / google/ExoPlayer

Allow ad loaders to time out custom ad loading

Open
#5,209 5 comments 0 reactions 1 assignee Claimed by @andrewlewis View on GitHub
enhancement low priority
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

//Version
2.8.0

// Source code
I prepare AdPlaybackState as follows:
```
long contentDurationMs = config.getMovie().getDuration() * 60 * 1000;
long midrollIntervalMs = config.getPlayerSettings().getAdvertiseInterval() * 1000;
int midrollCount = (int) (contentDurationMs / midrollIntervalMs);
int adCount = midrollCount + 2;
long adGroupTimesUs[] = new long[adCount];
for (int i = 0; i < adCount; i++){
if (i == 0){
// pre-roll
adGroupTimesUs[i] = 0;
}
else if (i == adCount - 1){
// post-roll
adGroupTimesUs[i] = C.TIME_END_OF_SOURCE;
}
else {
// mid-roll
adGroupTimesUs[i] = i * midrollIntervalMs * 1000;
}

}
mAdPlaybackState = new AdPlaybackState(adGroupTimesUs)
.withContentDurationUs(contentDurationMs * 1000);

```
//Description

I have noticed that if AdPlaybackState is set with a number of ads then AdsMediaSource stops at their position (ExoPlayer state == buffering) and goes nowhere, even though ad uris have not been set and ad count in ad groups have not been set.

Is this the desgined behaviour? And is there a simple way to make AdsMediaSource skip unloaded ad groups automatically?

My goal is to show ad timings on player's progress bar right away and then load actual ad VASTS (I use my own implementation of AdsLoader) one minute before it is time to play ad group. However, if ad group is still not ready (for example, user seeks to the middle of the video passing ad group) I expected AdsMediaSource to just ignore it (as if it failed to load).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.