videojs / mpd-parser

https://videojs.github.io/mpd-parser/
Other
79 stars 54 forks source link

Not functional in nodejs #85

Closed jagadishkamathk closed 3 years ago

jagadishkamathk commented 4 years ago

I tried to use mpd-parser in a node environment and there are multiple issues

  1. TypeError: window$1.DOMParser is not a constructor
  2. TypeError: Cannot read property 'href' of undefined

I could workaround for #1 by using 'xmldom' and then setting that in global. Couldn;t get #2 working

gkatsev commented 4 years ago

Can you provide an example of how you're using it? Just tried requiring it locally and it seems to be working.

jagadishkamathk commented 4 years ago

Here is my simple index.js with only axios and mpd-parser as dependency

const dash   =  require("mpd-parser")
const axios = require("axios")
const url = "http://dash.edgesuite.net/akamai/bbb_30fps/bbb_30fps.mpd"

axios.get(url)
.then(function(media_data) {
    var parsedManifest = dash.parse(media_data.data, url);
    console.log(parsedManifest);
})
gkatsev commented 4 years ago

We use it in hls-fetcher in node and it's working see https://github.com/videojs/hls-fetcher/pull/35/files#diff-19fa81396ca7a1262231cd1e39410fde