File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -699,13 +699,13 @@ shaka.ads.InterstitialAdManager = class {
699
699
shaka . util . Error . Category . ADS ,
700
700
shaka . util . Error . Code . VAST_INVALID_XML ) ;
701
701
}
702
+ /** @type {!Array<shaka.extern.AdInterstitial> } */
702
703
let interstitials = [ ] ;
703
704
if ( data . tagName == 'VAST' ) {
704
705
interstitials = shaka . ads . Utils . parseVastToInterstitials (
705
706
data , this . lastTime_ ) ;
706
707
} else if ( data . tagName == 'vmap:VMAP' ) {
707
- for ( const ad of shaka . ads . Utils . parseVMAP ( data ) ) {
708
- // eslint-disable-next-line no-await-in-loop
708
+ const vastProcessing = async ( ad ) => {
709
709
const vastResponseData = await this . makeAdRequest_ ( ad . uri , context ) ;
710
710
const vast = shaka . util . TXml . parseXml ( vastResponseData , 'VAST' ) ;
711
711
if ( ! vast ) {
@@ -716,6 +716,13 @@ shaka.ads.InterstitialAdManager = class {
716
716
}
717
717
interstitials . push ( ...shaka . ads . Utils . parseVastToInterstitials (
718
718
vast , ad . time ) ) ;
719
+ } ;
720
+ const promises = [ ] ;
721
+ for ( const ad of shaka . ads . Utils . parseVMAP ( data ) ) {
722
+ promises . push ( vastProcessing ( ad ) ) ;
723
+ }
724
+ if ( promises . length ) {
725
+ await Promise . all ( promises ) ;
719
726
}
720
727
}
721
728
this . addInterstitials ( interstitials ) ;
You can’t perform that action at this time.
0 commit comments