com.google.ads.interactivemedia.v3.api.AdsRequest Java Examples
The following examples show how to use
com.google.ads.interactivemedia.v3.api.AdsRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdController.java From xipl with Apache License 2.0 | 6 votes |
/** * Requests video ads from the given VAST ad tag. * * @param adRequestUrl URL of the ad's VAST XML. */ public void requestAds( @NonNull String adRequestUrl, @NonNull AdControllerCallback adControllerCallback) { mAdControllerCallback = adControllerCallback; mAdDisplayContainer = mSdkFactory.createAdDisplayContainer(); mAdDisplayContainer.setPlayer(new VideoAdPlayerImpl()); mAdDisplayContainer.setAdContainer(mStubViewGroup); // Create the ads request. AdsRequest request = mSdkFactory.createAdsRequest(); request.setAdTagUrl(adRequestUrl); request.setAdDisplayContainer(mAdDisplayContainer); // Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called. mAdsLoader.requestAds(request); }
Example #2
Source File: AdController.java From androidtv-sample-inputs with Apache License 2.0 | 6 votes |
/** * Requests video ads from the given VAST ad tag. * * @param adRequestUrl URL of the ad's VAST XML. */ public void requestAds( @NonNull String adRequestUrl, @NonNull AdControllerCallback adControllerCallback) { mAdControllerCallback = adControllerCallback; mAdDisplayContainer = mSdkFactory.createAdDisplayContainer(); mAdDisplayContainer.setPlayer(new VideoAdPlayerImpl()); mAdDisplayContainer.setAdContainer(mStubViewGroup); // Create the ads request. AdsRequest request = mSdkFactory.createAdsRequest(); request.setAdTagUrl(adRequestUrl); request.setAdDisplayContainer(mAdDisplayContainer); // Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called. mAdsLoader.requestAds(request); }
Example #3
Source File: VideoPlayerController.java From googleads-ima-android with Apache License 2.0 | 6 votes |
/** Request and subsequently play video ads from the ad server. */ public void requestAndPlayAds(double playAdsAfterTime) { if (mCurrentAdTagUrl == null || mCurrentAdTagUrl == "") { log("No VAST ad tag URL specified"); resumeContent(); return; } // Since we're switching to a new video, tell the SDK the previous video is finished. if (mAdsManager != null) { mAdsManager.destroy(); } mAdsLoader.contentComplete(); mPlayButton.setVisibility(View.GONE); // Create the ads request. AdsRequest request = mSdkFactory.createAdsRequest(); request.setAdTagUrl(mCurrentAdTagUrl); request.setContentProgressProvider(mVideoPlayerWithAdPlayback.getContentProgressProvider()); mPlayAdsAfterTime = playAdsAfterTime; // Request the ad. After the ad is loaded, onAdsManagerLoaded() will be called. mAdsLoader.requestAds(request); }
Example #4
Source File: ImaPlayer.java From google-media-framework-android with Apache License 2.0 | 5 votes |
/** * 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; }
Example #5
Source File: ImaService.java From googleads-ima-android with Apache License 2.0 | 5 votes |
public void requestAds(String adTagUrl) { AdsRequest request = sdkFactory.createAdsRequest(); request.setAdTagUrl(adTagUrl); // The ContentProgressProvider is only needed for scheduling ads with VMAP ad requests request.setContentProgressProvider( new ContentProgressProvider() { @Override public VideoProgressUpdate getContentProgress() { return new VideoProgressUpdate(exoPlayer.getCurrentPosition(), exoPlayer.getDuration()); } }); adsLoader.requestAds(request); }