Release the resource. Resolves once the player confirmed the release (or immediately for purely local resources). Never rejects.
A "Turn feature off" item removes the feature's own menu item at once,
before the plugin stops. dispose takes the command out of the menu and
the binding table and resolves once the player confirmed it; the id can
be added again later.
const extra = plugin.commands.add({ id: "extra", path: ["Tools", "Extra"], run() {} });
plugin.commands.add({
id: "extra-off",
path: ["Tools", "Turn extra off"],
run: () => extra.dispose(), // never rejects
});
Replace the layer (last write wins; [] clears it). At most 1000 marks,
titles ≤ 100 characters, times within the media. Failures go to onError;
with ifCurrent, a write for another source is dropped silently. A title
is data (a chapter's or bookmark's own name), or a Text the player
translates (text("Chapter {}", [n])); other plugins read the shown
string.
Optionaloptions: { ifCurrent?: PlayerState }Bookmark marks appear on the seek bar at their times, titled with the
user's notes. set replaces this plugin's whole layer; with ifCurrent
the player drops the write if another file opened since seen was
read, so bookmarks of the previous file never land on the new one.
const layer = plugin.timeline.layer();
const seen = plugin.player.state; // the file the bookmarks belong to
layer.set(
bookmarks.map((b) => ({ time: b.time, kind: "bookmark", title: b.note })),
{ ifCurrent: seen },
);
Replace the layer's ranges (last write wins; [] clears them), spans of
the media drawn on the seek bar. The marks and the ranges of a layer are
replaced on their own: set keeps the ranges and setRanges keeps the
marks. Disposing the layer, its scope or stopping the plugin removes both,
and a new source clears every layer.
At most 1000 ranges (TIMELINE_LIMITS.ranges), 0 ≤ start < end, end
within the media while its duration is known, titles ≤ 100 characters.
Ranges may overlap. Failures go to onError; with ifCurrent, a
write for another source is dropped silently. A title is data or a
Text the player translates, as in set.
Optionaloptions: { ifCurrent?: PlayerState }The span the user picked shows on the seek bar in the accent colour while the plugin's tab is showing, and goes when it is not. Two point marks would show the ends but not the span between them.
const layer = plugin.timeline.layer();
// Only while the tab is on screen; [] takes the range away.
const show = () =>
layer.setRanges(
panel.state?.effective
? [{ start: clip.start, end: clip.end, style: "selection", title: "Clip" }]
: [],
{ ifCurrent: plugin.player.state },
);
panel.onChange(show);
This plugin's own marks; disposing it removes them.
Remarks
This plugin's marks on the seek bar, from Timeline.layer.
setreplaces the whole layer and never throws: the newest write wins, and a refused one is reported toonError. Disposing the layer, its scope or stopping the plugin removes the marks.Example: Clear the plugin's marks
The plugin's marks disappear from the seek bar while it keeps its layer for later. An empty list clears the layer; other plugins' marks stay.
Since
1.0.0