warren-bank / HLS-Proxy

Node.js server to proxy HLS video streams
http://webcast-reloaded.surge.sh/proxy.html
GNU General Public License v2.0
256 stars 80 forks source link

with cloudflare workers #40

Open ImPeekaboo opened 11 months ago

ImPeekaboo commented 11 months ago

Thanks for your project, this is so useful. Is it possible to make this work on cloudflare workers?

warren-bank commented 11 months ago

after reading this blog post that announced support for ES modules..

off-hand, I see 3 minor issues:

  1. the call to get_middleware would need to be made from a new entry point, which defines the params object
  2. the middleware.request method would need to be called from within the serverless fetch method.. and its parameters (ie: req and res) would need to be mocked in such a way that input data from Request is made available to the code.. and output data written to res is ultimately output through a new Response object
  3. HLS Proxy uses CommonJs modules, and it seems that Cloudflare Workers only supports ES modules.. so that's probably the biggest roadblock

at a higher level:

le shrug..

to summarize:

warren-bank commented 11 months ago

interesting rant.. which pretty much echoes my opinion exactly

it mentions something that I wasn't aware of.. maybe it was added later (after I'd already made up my mind about ES modules).. which is that there exists an import() statement to allow dynamic imports.. asinine.. but would make the rewrite from CommonJs much easier.

ImPeekaboo commented 11 months ago

I see. Thank you for your humble response!