From 30c5f22f1c954fe1229ffeff909dc0740035a213 Mon Sep 17 00:00:00 2001 From: fent <933490+fent@users.noreply.github.com> Date: Wed, 21 Oct 2020 16:52:40 -0700 Subject: [PATCH] fix: get format mime type from dash playlist --- lib/info.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/info.js b/lib/info.js index eab26dbb..dd63faff 100644 --- a/lib/info.js +++ b/lib/info.js @@ -256,14 +256,17 @@ const getDashManifest = (url, options) => new Promise((resolve, reject) => { let formats = {}; const parser = sax.parser(false); parser.onerror = reject; + let adaptationSet; parser.onopentag = node => { - if (node.name === 'REPRESENTATION') { + if (node.name === 'ADAPTATIONSET') { + adaptationSet = node.attributes; + } else if (node.name === 'REPRESENTATION') { const itag = parseInt(node.attributes.ID); if (!isNaN(itag)) { formats[itag] = { itag, url, bitrate: parseInt(node.attributes.BANDWIDTH), - codecs: node.attributes.CODECS, + mimeType: `${adaptationSet.MIMETYPE}; codecs="${node.attributes.CODECS}"`, }; if (node.attributes.HEIGHT) { Object.assign(formats[itag], {