Skip to content

mpv-easy/mpv-easy

Repository files navigation

mpv-easy

TS and React toolkit for mpv script mpv-easy

install

Download latest release zip file and extract all to the mpv scripts directory, for example:

portable_config
├── fonts
│   └── FiraCodeNerdFontMono-Regular.ttf
├── scripts
│   ├── mpv-easy.js
└── shaders
    ├── *.glsl

dev

bash

export MPV_SCRIPT_DIR=/your_mpv_dir/portable_config/scripts && pnpm run dev

fish

set -x MPV_SCRIPT_DIR /your_mpv_dir/portable_config/scripts ; pnpm run dev

example

drag-ball

drag-ball

snake

snake

i18n

i18n

counter-ui

counter-ui

config

mouseHoverStyle

Only supports Windows, requires installation of PowerShell to enable script execution permissions

set-executionpolicy remotesigned

mouseHoverStyle

plugin

quick start

mpv-easy-demo

more example

Q&A

mujs stack overflow

If your code throw a stack overflow error with mujs, you need to use the babel plugin hack.js . It adds a function variable at the beginning of all functions to expand the stack size. Alternatively, you can use a custom compiled version of mujs and mpv, change mujs JS_STACKSIZE

- #define JS_STACKSIZE 256	/* value stack size */

+ #define JS_STACKSIZE 1024	/* value stack size */

perf

Maybe should use GitHub action to automatically update this

js engine first render average js file size
qjs 358ms 3.58ms 1.4M
qjs+minify 334ms 3.42ms 300K
mujs+es5 402 ms 14.05ms 1.1M
deno 291 ms 0.23ms 1.4M
deno+minify 464 ms 0.23ms 306K
boa+es6 400 ms 21.88ms 1.2M

todo

  • flex (30%)
  • grid
  • logo
  • bilibili
  • youtube
  • animation
  • es2022
  • test
  • mpv prop type
  • plugin system
  • menu system
  • CI snapshot test
  • font rem
  • sourcemap
  • node console
  • es/cjs plugin module
  • real-time subtitle translation
  • sourcemap