mpv.d.ts
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

mpv.d.ts

TypeScript definitions for mpv JavaScript API.

Install

npm i -D mpv.d.ts

Usage

Example tsconfig.json:

{
  "compilerOptions": {
    "lib": ["ES5"],
    "target": "ES5",
    "module": "ESNext",
    "moduleResolution": "node"
  }
}

Note the lib and target options, those are correspond to MuJS runtime capabilities (mpv's scripting backend).

You can also import auxiliary types which are not part of the official API but provided for convenience:

import type { MP } from "mpv.d.ts";

const encoders = mp.get_property_native("encoder-list") as MP.Prop.Encoder[];
mp.msg.info(encoders.length);

mp.command_native_async(
  {
    name: "subprocess",
    args: ["echo", "test"],
    playback_only: false,
    capture_stdout: true,
  } satisfies MP.Cmd.SubprocessArgs,
  (success, res: MP.Cmd.SubprocessResult, error) => {
    mp.msg.info(res.stdout);
  }
);

Package Sidebar

Install

npm i mpv.d.ts

Weekly Downloads

1

Version

0.3.1

License

CC0-1.0

Unpacked Size

17.6 kB

Total Files

4

Last publish

Collaborators

  • kagami