The window state changed, here or elsewhere (the listener keeps the
plugin running; window.changed with Player.on does not).
Resize the window so the video column is width×height (the bottom bar
and a docked sidebar are added), keeping the top-left corner, moved back
inside the screen's visible area. Too large: scaled down keeping the
aspect; too small: raised to the minimum; clamped then. Resolves with
the video area applied. unavailable in fullscreen.
Sizes are 1–16384 logical points; the minimum video area is 318×120.
The visible area excludes the menu bar and Dock on macOS; on Windows it
is the whole display. unavailable without a user interface too.
The window resizes so that the video column is 1280×720 logical points,
the bars and a docked sidebar added around it. A request that does not
fit the screen is scaled down keeping the aspect, and clamped says so.
const applied = await plugin.window.setVideoArea({ width: 1280, height: 720 });
if (applied.clamped) await plugin.osd.show("{}×{}", [applied.width, applied.height]);
Float the player's windows above other applications. Newest call wins; reverts when this plugin stops.
unavailable without a user interface.
The player's windows (tool windows too) float above other applications while the plugin's "Always on top" item is checked. The newest call of any plugin wins, and the setting reverts when this plugin stops.
let onTop = false;
plugin.commands.add({
id: "on-top",
path: ["@screen", "Always on top"],
checked: () => onTop,
run: async () => {
onTop = !onTop;
await plugin.window.setAlwaysOnTop(onTop); // reverts when this plugin stops
},
});
"playing": hide the pointer over the video after 3 idle seconds while
playing, in a window too (not only fullscreen). Newest call wins;
reverts to "fullscreen" when this plugin stops.
Play the video in the system picture-in-picture window (true) or back
in the main window. Resolves once the window has opened or closed and
state.pictureInPicture shows it. From fullscreen the player leaves
fullscreen first. unsupported where supported is false; unavailable
without video; busy while the previous call is still switching;
failed when the system refuses. The window's play/pause and skip
buttons drive playback; its close button also pauses. It closes when
this plugin stops or the video goes away.
Where it is unsupported (Windows, Linux), setVideoArea plus
setAlwaysOnTop make a reasonable "mini player" fallback.
The video moves into a floating picture-in-picture window, or back.
state.pictureInPicture says whether the system supports it and
whether it is on; the plugin only calls setPictureInPicture where it
is supported.
if (plugin.window.state.pictureInPicture.supported)
await plugin.window.setPictureInPicture(!plugin.window.state.pictureInPicture.active);
The player's main window: read it, change it.
stateis read at start; it follows the window while anonChangelistener exists, and takes eachwindow.changedaplayer.onlistener hears; otherwise it updates only after this plugin'ssetVideoArea.Example: Resize the window to the video's own size
Screen ▸ Original size makes the video area as many logical points as the video has pixels (one pixel per pixel at a display scale of 100 %).
stats()reports the video's size;setVideoArearesizes the window around the video column (bars and a docked sidebar added), scales it down if it would not fit the screen, and is refused in fullscreen, hence theenabledcheck.Remarks
plugin.windowis the player's main window: its size, whether it is maximized or fullscreen, picture-in-picture and the video area. Changes that last only while the plugin runs (always on top, pointer auto-hide) revert when it stops.Since
1.0.0