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

Ad tag retrieval unblocking #9237

Closed
danish241194 opened this issue Jul 29, 2021 · 9 comments
Closed

Ad tag retrieval unblocking #9237

danish241194 opened this issue Jul 29, 2021 · 9 comments
Assignees
Labels

Comments

@danish241194
Copy link

Currently if we add an AdTag Uri and Content Uri and then prepare and play as shown below

MediaItem firstItem =
    new MediaItem.Builder()
        .setUri(firstVideoUri)
        .setAdTagUri(adTagUri)
        .build();

player.addMediaItem(firstItem);
player.prepare();
player.play()

(using IMA)

player doesn't play content till ads are fetched, In my case i don't want player to wait for Ads as it increases ( time to display first frame) .Is there any way i can achieve this.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jul 30, 2021

I think if you are using an adTagUri, the ad tag from that URI is fetched first to check what ads are to be inserted. If there is a preroll ad, then the ad is loaded and played first. If there is no preroll add the ad media will be loaded as soon as it is required.

Can you give us some more details on what is in that ad tag and whether there is a pre-roll involved? Do you see that ExoPlayer is waiting for ad media that is not playing as pre-roll? You can also post the URI to the ad tag for inspection if you want.

@marcbaechinger
Copy link
Contributor

marcbaechinger commented Jul 30, 2021

Another note: If this is about a case where the ad tag is not properly loading, you can set a timeout.

@danish241194
Copy link
Author

@marcbaechinger thanks for your response , As per your comment " the ad tag from that URI is fetched first to check what ads are to be inserted " here we don't want it to fetch it in the beginning as we are always having mid roll ads. Can we control this ad Tag fetch call , i mean to can we do it like fetch at some particular second of video content.

@marcbaechinger
Copy link
Contributor

I don't think this is possible. The ad tag is always loaded first.

@andrewlewis
Copy link
Collaborator

Not sure if this is helpful, but there is a way to "preload" the ad tag independently of starting playback, see ImaAdsLoader.requestAds. Maybe you can preload the ad tag before starting playback as a workaround.

@danish241194 danish241194 reopened this Aug 3, 2021
@danish241194
Copy link
Author

@marcbaechinger Are ads tag url and content url calls getting fired simultaneously ?

@andrewlewis
Copy link
Collaborator

AdsMediaSource prepares the content MediaSource at the same time as requesting the ad tag. However, the content media period isn't created until the ad tag has loaded, because media periods are always created in order and we don't whether we need to create a media period for a preroll ad until the ad tag has loaded. So if the content is progressive (like an MP4), it won't actually start loading until the ad tag has loaded. #4727 tracks being able start loading progressive content in prepareSource rather than at the point of creating the media period.

In the short term, I'd recommend either pre-requesting the ad tag (if there is a suitable point before starting playback when you know you'll need the ads) or alternatively splitting the content into two clips where the first clip is just content (with no ad tag URI) and the second clip has the ad tag URI. The ad tag will be preloaded before playback reaches the second clip. To make the transition seamless, the second clip needs to start on a keyframe.

@danish241194
Copy link
Author

thanks @andrewlewis , wondering if we already have ad tag url's response (VAST) as string , can we pass this thing directly to player so that it can directly use it and doesn't have to fetch this same response from ad tag url.

@andrewlewis
Copy link
Collaborator

Yes, although it requires everything to be part of the ad tag (you can't have a VMAP ad tag that points to other ad tags). It should work to build a data: scheme URI and pass that as the ad tag URI -- see this documentation.

@ojw28 ojw28 closed this as completed Sep 6, 2021
@google google locked and limited conversation to collaborators Nov 6, 2021
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

4 participants