Interface WindowAPI

The interface of core.window. Controls the player window.

Seealso

The Core module

Hierarchy

  • WindowAPI

Properties

loaded: boolean

Whether the window is loaded. Typically, the window is loaded when it's going to play the first file. The window must be loaded to display OSDs and overlays. If these APIs are called before the window is loaded, they will be ignored or even raise an error.

Seealso

Use event.on("iina.window-loaded") to listen to the event.

visible: boolean

Whether the window is visible on the screen.

screens: {
    frame: Rect;
    main: boolean;
    current: boolean;
}[]

Get the information of all screens in the system.

frame: Rect

Get or set the current position and size of the window.

Example

// get the current frame
let frame = core.window.frame;
// move the window to (100, 100)
core.window.frame = { ...frame, x: 100, y: 100 };

Seealso

Use event.on("iina.window-moved") and event.on("iina.window-resized") to get notified when the frame changes.

fullscreen: boolean

Get or set the current fullscreen state.

Example

// toggle fullscreen
core.window.fullscreen = !core.window.fullscreen;
pip: boolean

Get or set the current Picture-in-Picture (PIP) state.

ontop: boolean

Get or set the current always-on-top state.

Example

// make the window always on top
core.window.ontop = true;
sidebar: "sub" | `plugin:${string}` | "audio" | "video" | "playlist" | "chapters"

When reading, get the current displayed sidebar name, or null if no sidebar is shown. When writing, show the sidebar with the specified name, or hide the sidebar if null is given.

Example

// show the playlist sidebar
core.window.sidebar = "playlist";
// hide the sidebar
core.window.sidebar = null;

Remarks

Note that plugins can add their own sidebars, and the sidebar names are prefixed with plugin:. If it's your own plugin, you can use sidebar.show instead.

Generated using TypeDoc