Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Fallback not working if top Ad Elements returns empty Vast or fails in case of multiple Ad Elements #465

Open
shubham-si opened this issue Jan 12, 2024 · 2 comments

Comments

@shubham-si
Copy link

https://github.com/dailymotion/vast-client-js/blob/master/src/parser/vast_parser.js#L461C25-L461C25

const resolvedAds = util.flatten(unwrappedAds); default to [] Link

if (!resolvedAds && this.remainingAds.length > 0) {

There seems to be a issue here !resolvedAds. Since !Array<T> gives false always, thus the code within if will not be executed at all.

So If any Ad element (going from top to bottom) fails to fetch xml or return empty vast, it will not fallback to next Ad Element.

<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="3.0">
<Ad>
<Wrapper fallbackOnNoAd="true">
<AdSystem/>
<Error>
<![CDATA[ https://error-pixel?[ERRORCODE] ]]>
</Error>
<VASTAdTagURI>
<![CDATA[ ]]>
</VASTAdTagURI>
<Extensions>
<Extension type="waterfall" fallback_index="0"/>
</Extensions>
</Wrapper>
</Ad>
<Ad>
<Wrapper fallbackOnNoAd="true">
<AdSystem/>
<Error>
<![CDATA[ https://error-pixel?[ERRORCODE] ]]>
</Error>
<VASTAdTagURI>
<![CDATA[ does-not-exist ]]>
</VASTAdTagURI>
<Extensions>
<Extension type="waterfall" fallback_index="1"/>
</Extensions>
</Wrapper>
</Ad>
<Ad>
<Wrapper>
<AdSystem/>
<Error>
<![CDATA[ https://error-pixel?[ERRORCODE] ]]>
</Error>
<VASTAdTagURI>
<![CDATA[ https://glomex.github.io/vast-ima-player/linear-ad.xml ]]>
</VASTAdTagURI>
<Extensions>
<Extension type="waterfall" fallback_index="2"/>
</Extensions>
</Wrapper>
</Ad>
</VAST>

Fix: if (resolvedAds.length === 0 && this.remainingAds.length > 0) {

so that if resolvedAds fails and we have remainingAds, can be proceeded with them.

@shubham-si shubham-si changed the title Bug: Fallback not working if top Ad Elements returns empty Vast in case of multiple Ad Elements Bug: Fallback not working if top Ad Elements returns empty Vast or fails in case of multiple Ad Elements Jan 12, 2024
@Rapha0511
Copy link
Contributor

Hello !
thank you for reporting this issue, we will take a look at it asap !

@shubham-si
Copy link
Author

@Rapha0511 is the bug fixed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants