expo-mpv 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build/withExpoMpv');
|
package/ios/ExpoMpv.podspec
CHANGED
|
@@ -19,13 +19,6 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
|
|
20
20
|
s.dependency 'ExpoModulesCore'
|
|
21
21
|
|
|
22
|
-
# Download MPVKit xcframeworks if not present
|
|
23
|
-
s.script_phase = {
|
|
24
|
-
:name => 'Download MPVKit XCFrameworks',
|
|
25
|
-
:script => 'bash "${PODS_TARGET_SRCROOT}/download-mpvkit.sh"',
|
|
26
|
-
:execution_position => :before_compile,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
22
|
# System frameworks required by MPVKit
|
|
30
23
|
s.frameworks = [
|
|
31
24
|
'Metal',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-mpv",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "My new module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"lint": "expo-module lint",
|
|
11
11
|
"test": "expo-module test",
|
|
12
12
|
"prepare": "expo-module prepare",
|
|
13
|
-
"
|
|
14
|
-
"prepublishOnly": "expo-module prepublishOnly",
|
|
13
|
+
"prepublishOnly": "expo-module prepublishOnly && npx tsc --project plugin/tsconfig.json",
|
|
15
14
|
"expo-module": "expo-module",
|
|
16
15
|
"open:ios": "xed example/ios",
|
|
17
16
|
"open:android": "open -a \"Android Studio\" example/android"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const https_1 = __importDefault(require("https"));
|
|
11
|
+
const MPVKIT_VERSION = '0.41.0';
|
|
12
|
+
function getFrameworkSources() {
|
|
13
|
+
const mpvkit = `https://github.com/mpvkit/MPVKit/releases/download/${MPVKIT_VERSION}`;
|
|
14
|
+
const openssl = 'https://github.com/mpvkit/openssl-build/releases/download/3.3.5';
|
|
15
|
+
const gnutls = 'https://github.com/mpvkit/gnutls-build/releases/download/3.8.11';
|
|
16
|
+
const libass = 'https://github.com/mpvkit/libass-build/releases/download/0.17.4';
|
|
17
|
+
return [
|
|
18
|
+
// Core
|
|
19
|
+
{ name: 'Libmpv', url: `${mpvkit}/Libmpv.xcframework.zip` },
|
|
20
|
+
// FFmpeg
|
|
21
|
+
...['Libavcodec', 'Libavdevice', 'Libavformat', 'Libavfilter', 'Libavutil', 'Libswresample', 'Libswscale'].map((name) => ({ name, url: `${mpvkit}/${name}.xcframework.zip` })),
|
|
22
|
+
// OpenSSL
|
|
23
|
+
{ name: 'Libcrypto', url: `${openssl}/Libcrypto.xcframework.zip` },
|
|
24
|
+
{ name: 'Libssl', url: `${openssl}/Libssl.xcframework.zip` },
|
|
25
|
+
// GnuTLS
|
|
26
|
+
...['gmp', 'nettle', 'hogweed', 'gnutls'].map((name) => ({
|
|
27
|
+
name,
|
|
28
|
+
url: `${gnutls}/${name}.xcframework.zip`,
|
|
29
|
+
})),
|
|
30
|
+
// Libass + deps
|
|
31
|
+
...['Libunibreak', 'Libfreetype', 'Libfribidi', 'Libharfbuzz', 'Libass'].map((name) => ({
|
|
32
|
+
name,
|
|
33
|
+
url: `${libass}/${name}.xcframework.zip`,
|
|
34
|
+
})),
|
|
35
|
+
// Others
|
|
36
|
+
{ name: 'MoltenVK', url: 'https://github.com/mpvkit/moltenvk-build/releases/download/1.4.1/MoltenVK.xcframework.zip' },
|
|
37
|
+
{ name: 'Libshaderc_combined', url: 'https://github.com/mpvkit/libshaderc-build/releases/download/2025.5.0/Libshaderc_combined.xcframework.zip' },
|
|
38
|
+
{ name: 'lcms2', url: 'https://github.com/mpvkit/lcms2-build/releases/download/2.17.0/lcms2.xcframework.zip' },
|
|
39
|
+
{ name: 'Libplacebo', url: 'https://github.com/mpvkit/libplacebo-build/releases/download/7.351.0-2512/Libplacebo.xcframework.zip' },
|
|
40
|
+
{ name: 'Libdav1d', url: 'https://github.com/mpvkit/libdav1d-build/releases/download/1.5.2-xcode/Libdav1d.xcframework.zip' },
|
|
41
|
+
{ name: 'Libuchardet', url: 'https://github.com/mpvkit/libuchardet-build/releases/download/0.0.8-xcode/Libuchardet.xcframework.zip' },
|
|
42
|
+
{ name: 'Libbluray', url: 'https://github.com/mpvkit/libbluray-build/releases/download/1.4.0/Libbluray.xcframework.zip' },
|
|
43
|
+
{ name: 'Libdovi', url: 'https://github.com/mpvkit/libdovi-build/releases/download/3.3.2/Libdovi.xcframework.zip' },
|
|
44
|
+
{ name: 'Libuavs3d', url: 'https://github.com/mpvkit/libuavs3d-build/releases/download/1.2.1-xcode/Libuavs3d.xcframework.zip' },
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function download(url, dest) {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const file = fs_1.default.createWriteStream(dest);
|
|
50
|
+
const request = (url) => {
|
|
51
|
+
https_1.default.get(url, (res) => {
|
|
52
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
53
|
+
request(res.headers.location);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (res.statusCode !== 200) {
|
|
57
|
+
reject(new Error(`Failed to download ${url}: ${res.statusCode}`));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
res.pipe(file);
|
|
61
|
+
file.on('finish', () => { file.close(); resolve(); });
|
|
62
|
+
}).on('error', reject);
|
|
63
|
+
};
|
|
64
|
+
request(url);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async function downloadFramework(source, frameworksDir) {
|
|
68
|
+
const zipPath = path_1.default.join(frameworksDir, `${source.name}.zip`);
|
|
69
|
+
await download(source.url, zipPath);
|
|
70
|
+
(0, child_process_1.execSync)(`unzip -q -o "${zipPath}" -d "${frameworksDir}"`, { stdio: 'pipe' });
|
|
71
|
+
fs_1.default.unlinkSync(zipPath);
|
|
72
|
+
}
|
|
73
|
+
async function downloadMPVKit(frameworksDir) {
|
|
74
|
+
const lockfile = path_1.default.join(frameworksDir, '.version');
|
|
75
|
+
if (fs_1.default.existsSync(lockfile) && fs_1.default.readFileSync(lockfile, 'utf-8').trim() === MPVKIT_VERSION) {
|
|
76
|
+
console.log(`[expo-mpv] MPVKit ${MPVKIT_VERSION} already downloaded.`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
console.log(`[expo-mpv] Downloading MPVKit ${MPVKIT_VERSION} XCFrameworks...`);
|
|
80
|
+
fs_1.default.rmSync(frameworksDir, { recursive: true, force: true });
|
|
81
|
+
fs_1.default.mkdirSync(frameworksDir, { recursive: true });
|
|
82
|
+
const sources = getFrameworkSources();
|
|
83
|
+
for (const source of sources) {
|
|
84
|
+
console.log(` ${source.name}...`);
|
|
85
|
+
await downloadFramework(source, frameworksDir);
|
|
86
|
+
}
|
|
87
|
+
fs_1.default.writeFileSync(lockfile, MPVKIT_VERSION);
|
|
88
|
+
console.log(`[expo-mpv] All MPVKit ${MPVKIT_VERSION} XCFrameworks downloaded.`);
|
|
89
|
+
}
|
|
90
|
+
const withExpoMpv = (config) => {
|
|
91
|
+
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
92
|
+
'ios',
|
|
93
|
+
async (config) => {
|
|
94
|
+
const packageDir = path_1.default.dirname(require.resolve('expo-mpv/package.json'));
|
|
95
|
+
const frameworksDir = path_1.default.join(packageDir, 'ios', 'Frameworks');
|
|
96
|
+
await downloadMPVKit(frameworksDir);
|
|
97
|
+
return config;
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
};
|
|
101
|
+
exports.default = withExpoMpv;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/withExpoMpv.ts"],"version":"5.9.3"}
|