Skip to content

Commit

Permalink
fix: get format mime type from dash playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Oct 21, 2020
1 parent d0776c2 commit 30c5f22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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], {
Expand Down

0 comments on commit 30c5f22

Please sign in to comment.