# Rebuilding and replacing native media libraries

This document applies only to components covered by an LGPL licence. It does
not grant rights in Mango Player's proprietary code, third-party content or
marks. The exact component set and hashes are in `component-manifest.json`.

## Android mobile

The `media_kit` backend loads `libmpv.so` as a separate native shared library.
To test a compatible modified build:

1. Download the source archives listed for the released Mango version. Check
   the public closure status before treating that set as complete corresponding
   source.
2. Rebuild the `default` media-kit Android flavor with `-Dgpl=false`,
   `--disable-gpl`, `--disable-nonfree` and `--enable-version3`.
3. Unpack the APK, replace `lib/<abi>/libmpv.so` for each ABI you support, and
   preserve the library name and public ABI.
4. Repack, zip-align and sign the APK with your own Android signing key.
5. Install it as a separate test build. Android will not accept it as an
   in-place update of a package signed by another key.

Mango does not add a native-library hash check or anti-tamper mechanism. Store
variants must not contain Jellyfin `libffmpegJNI.so`. The mobile Store build
retains its documented libVLC fallback; a compatible replacement can be made
by rebuilding the pinned VideoLAN sources, replacing the AAR native payloads,
repacking and signing the APK with a key controlled by the modifier.

## iPhone and iPad

The media-kit payload is an embedded `Mpv.xcframework` dynamic framework.
Rebuild the `ios-universal-video-default` flavor from the v0.6.0 source pack,
replace the matching framework in an Xcode archive, then re-sign the modified
application and framework with an Apple development identity you control.
Installation and execution remain subject to Apple's platform signing rules.
Mango does not supply Apple private keys and does not impose an additional
technical restriction on replacement of the LGPL framework.

This is the relink mechanism audited technically. Whether a particular App
Store distribution method satisfies every LGPL requirement is a legal-review
gate and is not certified by this document.

## Windows

`libmpv-2.dll` is a separate DLL next to `mango_player.exe`. Rebuild a
compatible libmpv DLL from the corresponding source and replace that file in a
copy of the installed application. Preserve its filename and exported libmpv
ABI. The current application does not verify the DLL hash.

The historical Windows payload's flags prove an LGPL variant, but its complete
static dependency closure and exact custom build command are not yet archived.
Therefore no Windows Store candidate is cleared by this document until a new,
reproducible DLL is produced or that closure is recovered.

## Android TV

Direct-download builds may contain the GPL Jellyfin decoder in addition to
libVLC. Google Play and Amazon builds must use the dedicated Store flavor,
which excludes Jellyfin but retains VideoLAN's LGPL libVLC fallback. To test a
modified libVLC, rebuild the pinned `vlc-android` + `libvlcjni` + VLC source
set, replace the AAR payloads in an unpacked APK, then repack and sign it with
a key controlled by the modifier. Mango performs no libVLC payload hash check.

## Support

Questions about the source pack or replacement procedure can be sent to
`legal@mangoplayer.app`. This technical guide is not legal advice.
