Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to do the preloading of the preroll ad in the Media3? #1040

Closed
Anas-mirza912 opened this issue Jan 29, 2024 · 3 comments
Closed
Assignees
Labels

Comments

@Anas-mirza912
Copy link

I'm using the IMA ads Extension in ExoPlayer, and I'm facing an issue where ads take some time to load due to internet connectivity or other unforeseen circumstances. To ensure a bufferless video playback experience in Android, I want to precache the IMA ad from the VAST file. While ExoPlayer automatically loads and stores midroll ads in the cache, it doesn't have sufficient time to preload preroll ads. Is there a way to address this issue and precache preroll ads for smoother playback?

@tonihei
Copy link
Collaborator

tonihei commented Jan 30, 2024

One simple way to address this issue is to call player.prepare() without attaching it to a visible surface yet (or have this surface hidden). Once the player transitions to Player.STATE_READY you know that the ad is available for playback instantly.

There is also ImaAdsLoader.requestAds which you can use to request the ad metadata in advance. This should also speed up the playback start because the player already knows which ad media to load.

@Anas-mirza912
Copy link
Author

Thank you for your response @tonihei . The issue is that after calling player.prepare(), the player takes some time to load the ad. Is there a way to precache the ad on the homepage before playing the video?

@tonihei
Copy link
Collaborator

tonihei commented Jan 30, 2024

My response above already pointed out two ways to precache the ad (or at least parts of the preparation process) before playback starts. Calling prepare earlier and only showing the output once its ready it probably the most reliable and easiest way.

@tonihei tonihei closed this as completed Mar 11, 2024
@androidx androidx locked and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants