use of com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider in project zype-android by zype.
the class PlayerFragment method requestAds.
private void requestAds(String adTagUrl) {
AdDisplayContainer adDisplayContainer = sdkFactory.createAdDisplayContainer();
adDisplayContainer.setAdContainer(playerView);
// 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);
}
use of com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider 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