Take files dropped on the video area. The first provider registered for an extension gets it; files nobody takes are ignored.
Paths are grouped by provider (an extension, case-insensitive, belongs to the provider that registered it first) in the order the file manager gave them, one call per provider. Folders are not expanded.
Dropping .srt or .ass files on the video loads each one as a subtitle
track. Each extension belongs to the provider that registered it first;
the player groups the dropped paths by provider and calls each provider
once with all of its paths, so .srt and .ass files dropped together
arrive in one call. (A panel under the pointer that listens with
onDrop takes the whole drop first.) The plugin reads each file itself
and uploads its bytes with subtitles.load.
plugin.drops.provide({
extensions: ["srt", "ass"],
drop: async ({ paths }) => {
// Only .srt and .ass files reach this provider.
for (const path of paths)
await plugin.subtitles.load(await readFile(path), {
format: path.endsWith(".ass") ? "ass" : "srt",
});
},
});
plugin.drops: files dropped on the video area. Needsui.drop.Remarks
Files dropped on the video area go to providers by extension: each extension belongs to the provider registered for it first, and each provider gets one call with all of its paths. Files nobody takes are ignored. A panel with Panel.onDrop takes drops on itself first.
Example: Collect dropped CHIP-8 programs
.ch8files dropped on the player are added to the plugin's list. The provider claims the extension; the player callsdropwith the dropped paths of that type, in the order the file manager gave them. Extensions go to the first provider: the built-in playlist claims every audio and video extension when it starts, and a built-in plugin cannot be disabled, so another plugin's provider for those never gets them (except a development load that replaces the playlist under its id).See
Panel.onDrop
Since
1.0.0