protected void loadAdFromVAST(String VASTXML,int width,int height) { // load an ad directly from VASTXML loadedOffscreen = true; AdWebView output = new AdWebView(this, null); RTBVASTAdResponse response = new RTBVASTAdResponse(width,height,AdType.VIDEO.toString(), null,null,"1"); response.setAdContent(VASTXML); response.setContentSource(UTConstants.RTB); response.addToExtras(UTConstants.EXTRAS_KEY_MRAID, true); output.loadAd(response); display(output); }
private void handleRTBResponse(VideoAd owner, RTBVASTAdResponse rtbAdResponse) { if (rtbAdResponse.getAdContent() != null) { if (UTConstants.AD_TYPE_VIDEO.equalsIgnoreCase(rtbAdResponse.getAdType())) { // Vast ads handleRTBVASTResponse(owner, rtbAdResponse); } else { continueWaterfall(ResultCode.UNABLE_TO_FILL); } } else { continueWaterfall(ResultCode.UNABLE_TO_FILL); } }
private void fireNotifyUrlForVideo(RTBVASTAdResponse adResponse) { if (UTConstants.AD_TYPE_VIDEO.equalsIgnoreCase(adResponse.getAdType())) { fireTracker(adResponse.getNotifyUrl()); } }
/** * Tests rtb banner Video response * * @throws Exception */ @Test public void testBannerVideoResponse() throws Exception { String bannerString = TestResponsesUT.rtbVASTVideo(); utAdResponse = new UTAdResponse(bannerString, null, MediaType.BANNER, "v"); assertNotNull(utAdResponse); LinkedList<BaseAdResponse> list = utAdResponse.getAdList(); assertNotNull(utAdResponse.getAdList()); while (!list.isEmpty()) { RTBVASTAdResponse vastAdResponse = (RTBVASTAdResponse) list.removeFirst(); assertEquals("rtb", vastAdResponse.getContentSource()); assertEquals("video", vastAdResponse.getAdType()); assertTrue(vastAdResponse.getAdContent().contains("<VAST version=\"2.0\">")); HashMap<String, Object> extras = vastAdResponse.getExtras(); assertTrue(extras.containsKey("MRAID")); assertTrue(extras.containsValue(true)); } }
private void handleRTBVASTResponse(final VideoAd owner, final RTBVASTAdResponse rtbAdResponse) { if (!StringUtil.isEmpty(rtbAdResponse.getAdContent())) { fireNotifyUrlForVideo(rtbAdResponse); if (rtbAdResponse != null && rtbAdResponse.getAdContent() != null) { initiateVastAdView(owner, rtbAdResponse); } else { continueWaterfall(ResultCode.UNABLE_TO_FILL); } } }
private void handleRTBResponse(Ad ownerAd, BaseAdResponse rtbAdResponse) { if (rtbAdResponse instanceof RTBNativeAdResponse) { handleNativeResponse(ownerAd, rtbAdResponse); } else { AdView owner = (AdView) ownerAd; if (rtbAdResponse.getAdContent() != null) { if (UTConstants.AD_TYPE_BANNER.equalsIgnoreCase(rtbAdResponse.getAdType()) || UTConstants.AD_TYPE_VIDEO.equalsIgnoreCase(rtbAdResponse.getAdType())) { // Fire Notify URL - Currently only for Video Ad's if (UTConstants.AD_TYPE_VIDEO.equalsIgnoreCase(rtbAdResponse.getAdType())) { fireTracker(((RTBVASTAdResponse) rtbAdResponse).getNotifyUrl(), Clog.getString(R.string.notify_url)); } // Standard ads or Video Ads initiateWebview(owner, rtbAdResponse); } else { Clog.e(Clog.baseLogTag, "handleRTBResponse failed:: invalid adType::" + rtbAdResponse.getAdType()); continueWaterfall(ResultCode.INTERNAL_ERROR); } } else { continueWaterfall(ResultCode.UNABLE_TO_FILL); } } }
protected void loadAdFromVAST(String VASTXML,int width,int height) { // load an ad directly from VASTXML VideoWebView output = new VideoWebView(this.getContext(),this, null); RTBVASTAdResponse response = new RTBVASTAdResponse(width,height, AdType.VIDEO.toString(), null,null,"1"); response.setAdContent(VASTXML); response.setContentSource(UTConstants.RTB); response.addToExtras(UTConstants.EXTRAS_KEY_MRAID, true); getVideoAdView().setVideoWebView(output); output.loadAd(response); }
/** * Parse UT-V3 VAST response * @param rtbObject (JSONObject) * @param adType (String) * @throws Exception */ private void parseVideoAdResponse(JSONObject rtbObject, String adType, String notifyUrl, String creativeId) throws Exception { JSONObject videoObject = JsonUtil.getJSONObject(rtbObject, UTConstants.AD_TYPE_VIDEO); if (videoObject != null) { String vastResponse = JsonUtil.getJSONString(videoObject, RESPONSE_KEY_CONTENT); int height = JsonUtil.getJSONInt(videoObject, RESPONSE_KEY_PLAYER_HEIGHT); int width = JsonUtil.getJSONInt(videoObject, RESPONSE_KEY_PLAYER_WIDTH); //String vastResponse = JsonUtil.getJSONString(videoObject,RESPONSE_KEY_ASSET_URL); if (!StringUtil.isEmpty(vastResponse)) { RTBVASTAdResponse rtbAd = new RTBVASTAdResponse(width, height, adType, notifyUrl, getImpressionUrls(rtbObject), creativeId); rtbAd.setAdContent(vastResponse); rtbAd.setContentSource(UTConstants.RTB); rtbAd.addToExtras(UTConstants.EXTRAS_KEY_MRAID, true); adList.add(rtbAd); } } }