当前位置: 首页>>代码示例>>Java>>正文


Java AdDisplayContainer类代码示例

本文整理汇总了Java中com.google.ads.interactivemedia.v3.api.AdDisplayContainer的典型用法代码示例。如果您正苦于以下问题:Java AdDisplayContainer类的具体用法?Java AdDisplayContainer怎么用?Java AdDisplayContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdDisplayContainer类属于com.google.ads.interactivemedia.v3.api包,在下文中一共展示了AdDisplayContainer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestAds

import com.google.ads.interactivemedia.v3.api.AdDisplayContainer; //导入依赖的package包/类
/**
 * Request video ads from the given VAST ad tag.
 * @param adTagUrl URL of the ad's VAST XML
 */
private void requestAds(String adTagUrl) {
    AdDisplayContainer adDisplayContainer = mSdkFactory.createAdDisplayContainer();
    adDisplayContainer.setAdContainer(mAdUiContainer);

    // Create the ads request.
    AdsRequest request = mSdkFactory.createAdsRequest();
    request.setAdTagUrl(adTagUrl);
    request.setAdDisplayContainer(adDisplayContainer);
    request.setContentProgressProvider(new ContentProgressProvider() {
        @Override
        public VideoProgressUpdate getContentProgress() {
            if (mIsAdDisplayed || mVideoPlayer == null || mVideoPlayer.getDuration() <= 0) {
                return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
            }
            return new VideoProgressUpdate(mVideoPlayer.getCurrentPosition(),
                    mVideoPlayer.getDuration());
        }
    });

    // Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called.
    mAdsLoader.requestAds(request);
}
 
开发者ID:googleads,项目名称:googleads-ima-android,代码行数:27,代码来源:MyActivity.java

示例2: requestAndPlayAds

import com.google.ads.interactivemedia.v3.api.AdDisplayContainer; //导入依赖的package包/类
public void requestAndPlayAds(final String adTagUrl) {
    if (TextUtils.isEmpty(adTagUrl)) {
        requestResumeContent();
        return;
    }
    completeAd();

    final AdDisplayContainer container = sdkFactory.createAdDisplayContainer();
    container.setPlayer(videoAdPlayer);
    container.setAdContainer(adUiContainer);

    if (companionContainer != null) {
        CompanionAdSlot companionAdSlot = sdkFactory.createCompanionAdSlot();
        companionAdSlot.setContainer(companionContainer);
        companionAdSlot.setSize(companionWidth, companionHeight);
        ArrayList<CompanionAdSlot> companionAdSlots = new ArrayList<>();
        companionAdSlots.add(companionAdSlot);
        container.setCompanionSlots(companionAdSlots);
    }

    final AdsRequest request = sdkFactory.createAdsRequest();
    request.setAdTagUrl(adTagUrl);
    request.setAdDisplayContainer(container);
    request.setContentProgressProvider(contentProgressProvider);

    adsLoader.requestAds(request);
}
 
开发者ID:satorufujiwara,项目名称:exoplayer-ima,代码行数:28,代码来源:AdPlayerController.java

示例3: buildAdsRequest

import com.google.ads.interactivemedia.v3.api.AdDisplayContainer; //导入依赖的package包/类
/**
 * Create an ads request which will request the VAST document with the given ad tag URL.
 * @param tagUrl URL pointing to a VAST document of an ad.
 * @return a request for the VAST document.
 */
private AdsRequest buildAdsRequest(String tagUrl) {
  AdDisplayContainer adDisplayContainer = ImaSdkFactory.getInstance().createAdDisplayContainer();
  adDisplayContainer.setPlayer(videoAdPlayer);
  adDisplayContainer.setAdContainer(adUiContainer);
  AdsRequest request = ImaSdkFactory.getInstance().createAdsRequest();
  request.setAdTagUrl(tagUrl);
  request.setContentProgressProvider(contentProgressProvider);

  request.setAdDisplayContainer(adDisplayContainer);
  return request;
}
 
开发者ID:googleads,项目名称:google-media-framework-android,代码行数:17,代码来源:ImaPlayer.java


注:本文中的com.google.ads.interactivemedia.v3.api.AdDisplayContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。