use of com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate in project zype-android by zype.
the class PlayerFragment method requestAds.
//
// IMA SDK
//
private void requestAds(String adTagUrl) {
AdDisplayContainer adDisplayContainer = sdkFactory.createAdDisplayContainer();
adDisplayContainer.setAdContainer(videoFrame);
// Create the ads request.
AdsRequest request = sdkFactory.createAdsRequest();
request.setAdTagUrl(adTagUrl);
request.setAdDisplayContainer(adDisplayContainer);
request.setContentProgressProvider(new ContentProgressProvider() {
@Override
public VideoProgressUpdate getContentProgress() {
if (isAdDisplayed || player == null || player.getDuration() <= 0) {
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
}
return new VideoProgressUpdate(player.getCurrentPosition(), player.getDuration());
}
});
// Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called.
adsLoader.requestAds(request);
}
Aggregations