-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Hello everyone.
bugreport-foster_e_hdd-OPR6.170623.010-2019-06-26-17-08-57.zip
I'm working on an Android TV project where we need to integrate ads into Exoplayer. Those ads come from DFP server.
Issue description
In our case, I always receive 3 preroll slots even if some are empty. In this case, lib shows me an error in logs and start content even if next slot is filled. On the screen, I see "ads 1 on 2", so I think lib is understanding in some ways that there is only two ads. But the second ads is never starting.
To summarize:
When there is 0 ad, video starts
When there is 1 ad, no ads and video starts
When there is 2 ads, only one ad is played before video.
When there is 3 ads, all ads are played.
In this case, we have two options:
- Lib dismiss empty slots (how to configure it?)
- DFP only returns filled slots. (Is there any request param to acheive this?)
On a technical point:
I used ImaAdsLoader from :
implementation 'com.google.android.exoplayer:exoplayer:2.9.+'
implementation 'com.google.android.exoplayer:extension-ima:2.9.+'
to get ads into my exoplayer instance.
I used reference code from Google developer to implement it:
player = ExoPlayerFactory.newSimpleInstance(this,new DefaultTrackSelector(adaptiveTrackSelectionFactory));
AdsUrl = getTagPreroll();
ImaAdsLoader.Builder adsLoaderBuilder = new ImaAdsLoader.Builder(this);
adsLoaderBuilder.setVastLoadTimeoutMs(2000);
adsLoaderBuilder.setMediaLoadTimeoutMs(2000);
adsLoaderBuilder.setAdEventListener(new AdEvent.AdEventListener() {
@Override
public void onAdEvent(AdEvent adEvent) {
if(adEvent.getType() == AdEvent.AdEventType.CONTENT_RESUME_REQUESTED || adEvent.getType() == AdEvent.AdEventType.COMPLETED ){
isAdsPlaying = false;
}else if(adEvent.getType() == AdEvent.AdEventType.CONTENT_PAUSE_REQUESTED){
isAdsPlaying = true;
}
}
});
adsLoader = adsLoaderBuilder.buildForAdTag(Uri.parse(AdsUrl));
adsLoader.setPlayer(player);
MediaSource videoSource = buildMediaSource(Uri.parse(url));
MediaSource mediaSourceWithAds =
new AdsMediaSource(
videoSource, this, adsLoader, playerView);
player.prepare(mediaSourceWithAds,true, true);
To see, what happen, I used Fiddler between my box and the back office (saz files have to be open with Fiddler to show all requests decoded, even https, from my test session). I also checked callback adsEventListener to see what's coming from the lib.
On the Fiddler, I can see an empty vast:
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="4.0"/>
I see that lib is showing an error :
I/ImaAdsLoader: AdEvent: {errorMessage=VAST media file loading reached a timeout of 2 seconds., errorCode=402, type=adPlayError}
In this case it only play one ads and the content starts.
I also used :
VideoAdPlayer.VideoAdPlayerCallback()
With this callback, the result is very strange: it never goes throught onEnded or onError. The error is displayed in the log and the player restarts but thoses callbacks are not called.
Reproduction steps
I can reproduce this issue with the Exoplayer test application by using
2 ads, only one ad is played before video :
"ad_tag_uri": "http://pubads.g.doubleclick.net/gampad/ads?sz=1920x1080&iu=/21796898026/gulli_app_androidtv/video/preroll_16_9_1920x1080v&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&m_ast=vast&url=android_gulli_tv&correlator=1561560575412&ad_rule=1&cust_params=programme%3Dkallys_mashup_s1%26genre%3Dfamille%26sexe%3Dfille"
3 ads, all ads are played :
"ad_tag_uri": " http://pubads.g.doubleclick.net/gampad/ads?sz=1920x1080&iu=/21796898026/gulli_app_androidtv/video/preroll_16_9_1920x1080v&ciu_szs&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&m_ast=vast&url=android_gulli_tv&correlator=1561560106734&ad_rule=1&cust_params=programme%3Ddinotrux_s3%26genre%3Dtout-petits%26sexe%3Dgarcon"
with one item from "IMA sample ad tags",
A full bug report captured from the device
I added a bug_report.
Version of ExoPlayer being used
During my project I used 2.9.+ but I have the same result with demonstration application on release v2 branch.
Device(s) and version(s) of Android being used
We mainly tested on NVidiaShiled with Android TV 8.0.
Thanks for your help.