video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.67k stars 2.56k forks source link

Can I directly load the content of the m3u8 file instead of requesting the m3u8 url to get the content? #6195

Open theajack opened 7 months ago

theajack commented 7 months ago

What do you want to do with Hls.js?

Can I directly load the content of the m3u8 file instead of requesting the m3u8 url to get the content?

What have you tried so far?

No relevant API found in the documentation

robwalch commented 7 months ago

Officially, no. Unofficially, try triggering MANIFEST_LOADED.

theajack commented 7 months ago

Officially, no. Unofficially, try triggering MANIFEST_LOADED.

@robwalch Thanks, I'll give it a try

robwalch commented 7 months ago

The other options are to create a custom loader or use xhrSetup to capture a request for a "custom URL" and return the content via a fake response (loadSource('custom://replace-with-network-filter')) .

You could also encode the content in a data URL and pass that to loadSource.

RealAlphabet commented 1 month ago

You could also build a Blob from the String and pass the URL created by URL.createObjectUrl to hls.loadSource.