Buffering after updating AdPlaybackState with ad data
@marcbaechinger is already working on this.
Since Nov 15, 2024.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Version
ExoPlayer 2.16.1
More version details
Our repo forked from the version above
Devices that reproduce the issue
Multiple devices
Emulator Medium Phone API 33
Read device Tablet Android 11
Many user devices
Devices that do not reproduce the issue
N/A
Reproducible in the demo app?
No
Reproduction steps
Summary
We are implementing AdsLoader that will provide our ad data to the player
Our ad data is not known from the beginning, so we initialize AdPlaybackState with empty ad groups.
During content playback we obtain the actual ad data and update the ad group with it before it is reached.
After we update the new AdPlaybackState with the actual ad data (time + media uri) we observe the player starts buffering. How can we avoid this buffering?
Details
As ad breaks are not know on initialization so we allocate empty ad groups like this:
val midrollPlaceholders = LongArray(adBreakCount) { Long.MAX_VALUE }
adPlaybackState = AdPlaybackState(adsId, *midrollPlaceholders)
Marking all uninitialized ad groups as skipped
adPlaybackState.withSkippedAdGroup(adGroupIndex)
If the uninitialized ad groups are not marked as skipped, the playback gets stuck.
Later we resolve the ad break data and update upcoming ad group in some time ahead (e.g. one minute):
adPlaybackState.withAdGroupTimeUs(adGroupIndex, adGroupStartTime)
adPlaybackState.withAdCount(adGroupIndex, adCount)
adPlaybackState.withAdUri(adGroupIndex, adIndexInAdGroup, uri)
And updating the adPlaybackState to player:
AdsLoader.EventListener.onAdPlaybackState(adPlaybackState)
After this, we are observing ~1 sec buffering in the player
Player.Listener fun onPlaybackStateChanged(playbackState: Int) // STATE_BUFFERING
when the buffering is done (STATE_READY), content playing continues and the ad group plays once reached
What can we do to avoid this buffering when updating the ad group?
It looks like the player is buffering the content rather than the new ad group,
but there is no change expected in the content playback data.
Expected result
There should be no additional buffering of the content when AdPlaybackState is updated
The updated ad group is few minutes ahead, so it should have no impact on current content playback.
Actual result
After this, we are observing ~1 sec buffering in the player
What can we do to avoid this buffering when updating the ad group?
It looks like the player is buffering the content rather than the new ad group,
but there is no change expected in the content playback data.
Media
The bug was reproducible with any media. E.g.
https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.