@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface MainWindow

    The player's main window: read it, change it.

    state is read at start; it follows the window while an onChange listener exists, and takes each window.changed a player.on listener hears; otherwise it updates only after this plugin's setVideoArea.

    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; setVideoArea resizes 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 the enabled check.

    plugin.commands.add({
    id: "size-1x",
    path: ["Screen", "Original size"],
    enabled: () => !plugin.window.state.fullscreen,
    run: async () => {
    const stats = await plugin.player.stats();
    // No video stream (an audio file): nothing to size to.
    if (stats.video?.width && stats.video.height)
    await plugin.window.setVideoArea({ width: stats.video.width, height: stats.video.height });
    },
    });

    plugin.window is 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.

    1.0.0

    interface MainWindow {
        state: WindowState;
        onChange(listener: (state: WindowState) => void): Disposable;
        setVideoArea(
            size: { width: number; height: number },
        ): Promise<{ width: number; height: number; clamped: boolean }>;
        setAlwaysOnTop(onTop: boolean): Promise<void>;
        setCursorAutoHide(mode: "playing" | "fullscreen"): Promise<void>;
        setPictureInPicture(on: boolean): Promise<void>;
    }
    Index
    • The window state changed, here or elsewhere (the listener keeps the plugin running; window.changed with Player.on does not).

      Parameters

      Returns Disposable

      The plugin's panel uses larger text while the player is fullscreen. The listener runs after the SDK updated state from the player's events while it listens.

      plugin.window.onChange((state) => bar.set({ large: state.fullscreen }));
      

      1.0.0

    • 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.

      Parameters

      • size: { width: number; height: number }

      Returns Promise<{ width: number; height: number; clamped: boolean }>

      unavailable (rejects) Fullscreen, or no user interface.

      invalid (rejects) A size outside 1–16384 logical points.

      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]);

      1.0.0

    • Float the player's windows above other applications. Newest call wins; reverts when this plugin stops. unavailable without a user interface.

      Parameters

      • onTop: boolean

      Returns Promise<void>

      unavailable (rejects) No user interface.

      invalid (rejects) onTop is not a boolean.

      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
      },
      });

      1.0.0

    • "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.

      Parameters

      • mode: "playing" | "fullscreen"

      Returns Promise<void>

      invalid (rejects) A mode other than "fullscreen" or "playing".

      The pointer disappears after 3 idle seconds over playing video, not only in fullscreen. The newest call wins; when this plugin stops the player goes back to hiding it in fullscreen only.

      await plugin.window.setCursorAutoHide("playing");
      

      1.0.0

    • 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.

      Parameters

      • on: boolean

      Returns Promise<void>

      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);

      unsupported (rejects) The system has no picture-in-picture (supported is false).

      unavailable (rejects) No video, or no user interface.

      invalid (rejects) on is not a boolean.

      busy (rejects) The previous call is still switching.

      failed (rejects) The system refused.

      1.0.0

    Latest state; zero video area without a native window.