2

The latest Google Chromecast API has native ads functionality it supports VAST and VMAP formats, but we have found that if XML manifest file has type="aplication *" so the ads not work, chomecast ads functionality ignore this. Google cast issue Any idea of this? Ok, alterative solution was to use IMA sdk instead of standard CAF ads functionality. But I cannot start to play ads, there are always an error. I have used example of this code: google ima sdk example after media loads I have added timeout for 15 seconds and than load an ad, like this:

playerManager.setMessageInterceptor(
    cast.framework.messages.MessageType.LOAD, loadRequestData => {
        Utils.initIMA();
        setTimeout(()=>{
            playerManager.stop();
            Utils.requestAd('https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=12345678');
        }, 15000);
        return loadRequestData;
    });
var Utils = {
    requestAd: (adTagUrl) => {
        let adsRequest = new google.ima.AdsRequest();
        adsRequest.adTagUrl = adTagUrl;
        adsRequest.linearAdSlotWidth = mediaElement.width;
        adsRequest.linearAdSlotHeight = mediaElement.height;
        adsRequest.nonLinearAdSlotWidth = mediaElement.width;
        adsRequest.nonLinearAdSlotHeight = mediaElement.height / 3;
        adsLoader.requestAds(adsRequest);
    },
    initIMA : () => {
        let adDisplayContainer = new google.ima.AdDisplayContainer(document.getElementById('adContainer'), mediaElement);
       adDisplayContainer.initialize();
       adsLoader = new google.ima.AdsLoader(adDisplayContainer);
       adsLoader.getSettings().setPlayerType('cast/client-side');
       adsLoader.addEventListener(
           google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, 
           Utils.onAdsManagerLoaded, false);
       adsLoader.addEventListener(
           google.ima.AdErrorEvent.Type.AD_ERROR,   Utils.onAdError, false);
       adsLoader.addEventListener(
            google.ima.AdEvent.Type.ALL_ADS_COMPLETED, Utils.onAllAdsCompleted, false);
    }
}

Error reproduced on this line: adsLoader.requestAds(adsRequest); Uncaught TypeError: a.g.canPlayType is not a function

stress_tn
  • 174
  • 3
  • 12
  • 1
    Any progress on this? Seeing similar things! – Rebecca Sich Mar 28 '19 at 21:41
  • No. Still the same situation. If you have type="application..." then you will not see this ads. google cast support team can not resolve this issue. So you need to configure your ads. – stress_tn May 21 '19 at 08:28

0 Answers0