Adds experimental embedded MPV support for Windows and Linux, expands packaging/runtime validation, and updates CI coverage for the cross-platform native addon.
Embedded MPV Runtime
This folder contains tooling for preparing the libmpv runtime that is bundled with IPTVnator's experimental embedded MPV player.
Runtime Policy
Release builds must use an LGPL-compatible runtime:
- FFmpeg must be built without
--enable-gpland without--enable-nonfree. - mpv must be built with
-Dlibmpv=trueand-Dgpl=false. - The runtime must be dynamically linked so users can inspect and replace LGPL libraries.
- The exact source URLs, versions, build flags, local patches, and checksums must be published with the release.
Do not ship the Homebrew mpv runtime. It is acceptable only for local development when IPTVNATOR_EMBEDDED_MPV_ALLOW_HOMEBREW=1 is set, and release packaging rejects it.
Expected Layout
The native addon build consumes:
vendor/embedded-mpv/
darwin-arm64/
include/mpv/client.h
lib/*.dylib
runtime-manifest.json
darwin-x64/
include/mpv/client.h
lib/*.dylib
runtime-manifest.json
win32-x64/
include/mpv/client.h
lib/mpv-2.dll
lib/mpv.lib
runtime-manifest.json
linux-x64/
include/mpv/client.h
lib/libmpv.so.2
lib/libmpv.so
runtime-manifest.json
The generated lib/ and include/ directories are release inputs, not source files. They are ignored by git by default.
Staging A Built Runtime
After building an LGPL-compatible prefix for one platform/architecture, stage it with:
pnpm embedded-mpv:stage-runtime -- darwin arm64 /path/to/lgpl-prefix
pnpm embedded-mpv:stage-runtime -- darwin x64 /path/to/lgpl-prefix
pnpm embedded-mpv:stage-runtime -- win32 x64 /path/to/lgpl-prefix
pnpm embedded-mpv:stage-runtime -- linux x64 /path/to/lgpl-prefix
For compatibility, the legacy macOS-only staging command is still available:
pnpm embedded-mpv:stage-runtime:macos -- arm64 /path/to/lgpl-prefix
pnpm embedded-mpv:stage-runtime:macos -- x64 /path/to/lgpl-prefix
The prefix must contain include/mpv/client.h and the platform runtime files:
- macOS:
lib/libmpv.2.dyliborlib/libmpv.dylibplus all non-system dylib dependencies - Windows:
lib/mpv.liborlib/mpv-2.lib, andbin/mpv-2.dllorlib/mpv-2.dll - Linux:
lib/libmpv.so.2,lib/libmpv.so.1, orlib/libmpv.so; include alibmpv.solinker name when building locally
If the prefix contains runtime-manifest.json, the staging script copies its build metadata into the vendored manifest. At minimum, record:
- FFmpeg version, source URL, checksum, configure flags, and patches
- mpv version, source URL, checksum, Meson flags, and patches
- source-distribution URL for the corresponding release
Building The CI Runtime
Tagged macOS release builds build the runtime from pinned source archives before electron-backend:build. The workflow can also enable this path temporarily for macOS PR artifact testing:
pnpm embedded-mpv:build-runtime -- arm64 /tmp/embedded-mpv-prefix
pnpm embedded-mpv:stage-runtime -- darwin arm64 /tmp/embedded-mpv-prefix
During temporary PR and master artifact testing, CI restores an exact-keyed GitHub Actions cache for the staged vendor/embedded-mpv/<platform>-<arch>/ runtime before falling back to the macOS source build where available. The cache key includes the target platform, architecture, macOS deployment target, Xcode version when available, and hashes of the runtime build/staging scripts. Cache entries are saved only from trusted repository refs and are treated strictly as a speed optimization; tagged macOS release builds continue to rebuild from pinned sources unless a future signed and attested runtime artifact flow is introduced.
The builder currently pins:
- FFmpeg
8.1, configured without--enable-gplor--enable-nonfree, and with autodetected external libraries disabled - mpv
0.41.0, configured with-Dlibmpv=true -Dgpl=false - libplacebo
7.360.1, checked out from git with theglad, Python template,fast_float, andVulkan-Headerssubmodules required by its Meson build - libass
0.17.3plus FreeType, FriBidi, and HarfBuzz
The build manifest records source URLs, downloaded archive SHA-256 values where applicable, libplacebo git commit/submodule metadata, and the exact FFmpeg/mpv flags. The staged manifest is normalized to origin: vendored-lgpl, which is the only embedded MPV runtime origin allowed in required macOS release packaging.
Build Integration
apps/electron-backend/build-embedded-mpv.js links the native addon against the staged runtime, copies runtime libraries into apps/electron-backend/native/build/Release/lib/, rewrites macOS Mach-O paths to @loader_path, and writes embedded-mpv-runtime.json.
For local macOS development with Homebrew mpv, use:
pnpm run serve:backend:embedded-mpv
The script rebuilds the native addon with IPTVNATOR_EMBEDDED_MPV_ALLOW_HOMEBREW=1 before starting Electron with the experimental player enabled. Use this only for local testing; release packaging rejects the resulting homebrew-dev runtime manifest.
The afterPack hook copies dist/apps/electron-backend/native/ into app.asar.unpacked/electron-backend/native/ so the addon, runtime manifest, and runtime libraries are available as real files on macOS, Windows, and Linux.
During release packaging, tools/packaging/electron-after-pack.cjs verifies that the packaged app uses a vendored-lgpl runtime. macOS artifacts additionally verify that Mach-O dependencies have no /opt/homebrew or /usr/local dynamic links for embedded MPV.
Set IPTVNATOR_REQUIRE_EMBEDDED_MPV=1 when packaging a release artifact that must include Embedded MPV. The same variable is temporarily enabled for macOS PR and master push artifacts while the bundled runtime is being tested. Windows and Linux CI packaging requires Embedded MPV when an exact-keyed staged runtime cache is restored; otherwise those jobs build without the native addon and Settings keeps Embedded MPV hidden.
Platform Notes
- macOS keeps the existing libmpv render-context backend because mpv
widstays black inside Electron on macOS. - Windows uses an embedded child
HWNDand passes it to mpv throughwid. - Linux uses an X11 child window and passes it to mpv through
wid. Native Wayland is not supported in v1; run under X11/Xwayland soDISPLAYis set.