videojs / mpd-parser

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

Parser failing with blob url #150

Open nikosgpet opened 3 years ago

nikosgpet commented 3 years ago

I am using video.js which calls the mpd-parser in the background. An error occurs in mpd-parser if I call video.js with a blob url of an .mpd file, instead of a url from the internet.

I create the url as follows:

    const blob = new Blob([mpdContents], {type: 'application/dash+xml'})
    const url = URL.createObjectURL(blob)

It throws the following error:

resolve-url.js?fd22:31 Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at resolveUrl (resolve-url.js?fd22:31)
    at eval (mpd-parser.es.js?2202:1601)
    at Array.map (<anonymous>)
    at eval (mpd-parser.es.js?2202:1600)
    at Array.map (<anonymous>)
    at buildBaseUrls (mpd-parser.es.js?2202:1599)
    at inheritAttributes (mpd-parser.es.js?2202:2063)
    at parse (mpd-parser.es.js?2202:2176)
    at parseMasterXml (video.es.js?7ac5:31399)
    at DashPlaylistLoader.handleMaster_ (video.es.js?7ac5:32020)
    at eval (video.es.js?7ac5:31929)
    at callbackWrapper (video.es.js?7ac5:30636)
    at Object.eval [as callback] (video.es.js?7ac5:30661)
    at cbOnce (index.js?b664:104)
    at XMLHttpRequest.loadFunc (index.js?b664:178)

Are blob urls supported ? It would be great if they were :)