videojs / m3u8-parser

An m3u8 parser.
Other
473 stars 98 forks source link

chore: add NodeJS support for encrypted playlists #94

Closed macabu closed 5 years ago

macabu commented 5 years ago

Currently if you try to parse a playlist with #EXT-X-KEY tags it will fail, since decodeB64ToUint8Array uses a window.atob function which does not exist in NodeJS.

Added a check if the function is undefined, and use the Buffer.from implementation from NodeJS. As far as I have seen, Buffer.from exists since NodeJS 4.x Browser support is, of course, unchanged.

brandonocasey commented 5 years ago

I recently moved this code into @videojs/vhs-utils as it was used in 3-4 different places. I currently have a node support pull request that does nearly the same thing as this. When that lands we will update master and get node support! https://github.com/videojs/vhs-utils/pull/1

brandonocasey commented 5 years ago

FYI this is now out as 4.4.2