使用Videogular2的角色前imasdk广告期间的CORS错误

时间:2019-04-25 06:11:37

标签: cors angular6 videogular imasdk

我在视频上的ima-ads videogular2广告中的pre-role上出错了

<vg-player (onPlayerReady)="onPlayerReady($event)">
        <vg-scrub-bar-buffering-time></vg-scrub-bar-buffering-time>
        </vg-scrub-bar>
        <vg-controls>
        <vg-play-pause></vg-play-pause>
        <vg-time-display vgProperty="current" vgFormat="mm:ss"></vg-time-display>
        <vg-scrub-bar style="pointer-events: none;"></vg-scrub-bar>
        <vg-time-display vgProperty="total" vgFormat="mm:ss"></vg-time-display>
        <vg-mute></vg-mute>
        <vg-volume></vg-volume>
        <vg-fullscreen></vg-fullscreen>
        </vg-controls>
        <vg-ima-ads
        [vgCompanion]="'companion-ad'"
        [vgCompanionSize]="[728, 90]"
        [vgNetwork]="'6062'"
        [vgUnitPath]="'iab_vast_samples'"
   ==>  [vgAdTagUrl]="'http://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%3Dskippablelinear&correlator='"
        [vgSkipButton]="'.skip-button'">
        </vg-ima-ads>  
        <!-- player for normal videos -->
        <video *ngIf="vidCatname !== 'Live'" width="100%" [vgMedia]="media" #media id="videoautoplay"
        muted="{{autoplayboolean}}" autoplay preload="auto"(onloadstart)="adsInt()" (play)="setAutoplay(true)">
        <source src="{{cArr}}" type="video/mp4">
        </video>
        <!-- player for live stream[hls] -->
        <video *ngIf="vidCatname == 'Live'" #media [vgMedia]="media" [vgHls]="cArr"
        (onGetBitrates)="hlsBitrates = $event" id="my-video" type="video/mp4" id="videoautoplay"
        muted="{{autoplayboolean}}" preload="auto" (onloadstart)="adsInt()" (play)="setAutoplay(true)" autoplay>
        </video>
        </vg-player>
      <div class='skip-button'></div>
        <div id="companion-ad"></div>

视频开始播放时出现此错误: Error in console

  

通过'data:text; charset = utf-8'访问XMLHttpRequest(重定向)   从   'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=%2F124319096%2Fexternal%2Fsingle_ad_samples&ciu_szs=300x250&gdfp_req=1&env=vp&output=xml_vast4&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=2002013341878879&sdkv=h.3.296.0&sdki=44d&scor=2219238373648724&adk=1045637515&u_so=l&osd=2&frm=0&sdr=1&is_amp=0&adsid=AGt39rRYY2j6Wif3QJPrsk9arFRvjjRrLhrwIrlmiAQSuO2iSM5YbD8GoVtzJ4mPGob2AV-QP4C34NxWQMOQ&jar=2019-4-25-5&hl=en&dlt=1556171498474&idt=150&dt=1556171520179&cookie_enabled=1&url=null&ged=timeout')   来自原点“ null”的数据已被CORS政策阻止:否   请求中存在“ Access-Control-Allow-Origin”标头   资源

,错误来自

  

imasdk.googleapis.com/js/core/bridge3.296.0_en.html#goog_437544303:1

如何克服这个问题?

0 个答案:

没有答案