Skip to content

Commit

Permalink
fix: creatives without transcoded assets are not included in the VAST…
Browse files Browse the repository at this point in the history
… response

Signed-off-by: Fredrik Lundkvist <[email protected]>
  • Loading branch information
Lunkers committed Jan 24, 2025
1 parent 0aeab75 commit 7a5243d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/encore/encoreclient.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { EncoreClient } from './encoreclient';
import { EncoreJob, InputType } from './types';
import { ManifestAsset } from '../vast/vastApi';

jest.mock('../util/logger', () => ({
info: jest.fn()
Expand Down
6 changes: 4 additions & 2 deletions src/vast/vastApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ const replaceMediaFiles = (vastXml: string, assets: ManifestAsset[]) => {
const parser = new XMLParser({ ignoreAttributes: false });
const parsedVAST = parser.parse(vastXml);
if (parsedVAST.VAST.Ad) {
for (const ad of parsedVAST.VAST.Ad) {
parsedVAST.VAST.Ad = parsedVAST.VAST.Ad.reduce((acc: any[], ad: any) => {

Check warning on line 282 in src/vast/vastApi.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const adId = ad.InLine.Creatives.Creative.UniversalAdId[
'#text'
].replace(/[^a-zA-Z0-9]/g, '');
Expand All @@ -289,8 +289,10 @@ const replaceMediaFiles = (vastXml: string, assets: ManifestAsset[]) => {
asset.masterPlaylistUrl;
ad.InLine.Creatives.Creative.Linear.MediaFiles.MediaFile['@_type'] =
'application/x-mpegURL';
acc.push(ad);
}
}
return acc;
}, []);
}
const builder = new XMLBuilder({ format: true, ignoreAttributes: false });
const modifiedVastXml = builder.build(parsedVAST);
Expand Down

0 comments on commit 7a5243d

Please sign in to comment.