Allow ad loaders to time out custom ad loading
- 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
Assessment
This issue has not been assessed yet.