-
Notifications
You must be signed in to change notification settings - Fork 294
[Lily/Video] add m3u8 support #1785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!(await Scratch.canFetch(url))) return;
WARNING : If the resource URLs in a .m3u8 file are not on the same domain as the .m3u8 file itself, the client can fetch resources from other domains without using Scratch.fetch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you can do a check using a custom loader for hls.js before a playlist or fragment gets loaded. This is a quick mock up but haven't tested it at all:
this.hls = new Hls({
loader: class CustomLoader extends Hls.DefaultConfig.loader {
load(context, config, callbacks) {
let { type, url } = context;
// Custom behavior - do a check first
Scratch.canFetch(url).then(isAllowed => {
if (!isAllowed) {
callbacks.onErrorCallback({
code: 'Scratch_Error',
text: `${err}`
});
} else {
super.load(context, config, callbacks);
}
}).catch(err => callbacks.onErrorCallback({
code: 'Scratch_Error',
text: `${err}`
}));
}
}
});
If you use an outside library, you must make an offline copy of it and imbibe it into the extension directly, and include the license of said library in the extension as well. |
OK. I will do this. |
Add hls.js license and usage information
|
Addressed. Please review the changes. |
This comment was marked as abuse.
This comment was marked as abuse.
I've made a table describing the differences between each decision (we're temporarily setting aside the issue of native browser m3u8 loading violating TurboWarp's Scratch.fetch security model):
If I had to pick one, I'd choose "Dynamically loading hls.js with Video.js", but that comes at the cost of offline m3u8 playback for users (e.g., using localhost). But we need a solution that works for everyone. Giving Scratchers a consistent experience whether they're online or offline is important, but keeping future edits simple is also important for the extension's continued development. I believe that the need for external JavaScript libraries is common for TurboWarp extensions (e.g., a math extension may require an external math-related library), and I even think that neither embedding nor dynamically loading third-party JavaScript libraries as presented in the table is the optimal solution. |
This comment was marked as abuse.
This comment was marked as abuse.
One solution would be to host these libraries on extensions.turbowarp.org. This way, the desktop app would be able to load these offline (since it already has a full copy of extensions.turbowarp.org that it uses for everything else related to these extensions). |
This PR exists because a friend of mine wanted to play m3u8 in turbowarp (although he eventually achieved his goal by putting a webpage that includes hls.js into the iframe extension).
Please check my commits before I was asked to make the extension usable offline. Bundling hls.js within the extension was solely to meet the requirement of offline usability. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
i know the dependency situation is bad. some ideas floating around but nothing concrete yet. not only does the desktop need to get the extensions offline, files generated by the packager also need to embed all the extensions and their resources so they work offline. right now that is a very simple fetch() without an analysis step. at the same time i want to preserve the property that people can copy and paste an extension's unprocessed code from github and get something that works. sure lots of the rest of this project uses ancient dependencies but that does not mean we should stop caring for the other parts. notice that this repository is pretty up-to-date. |
This comment was marked as abuse.
This comment was marked as abuse.
Because I felt this wasn't the focus of my PR, and I don't agree with this point, I remained silent on this issue and presumptuously assumed you wouldn't care. My silence clearly hurt you, and I apologize for that. I should have opened a new issue to discuss versioning problems unrelated to the PR, instead of including issues unrelated to this PR within the PR itself. |
There's at least 1 person, not just 1. m3u8 is not an unpopular format; many websites use m3u8 to provide video services. |
@yuri-kiss @CubesterYT @jexjws |
Let's keep this open, it's a really good addition to the extension. |
This comment was marked as abuse.
This comment was marked as abuse.
I strongly disagree. |
Uh oh!
There was an error while loading. Please reload this page.