expo-mpv 0.1.5 → 0.1.6
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/README.md
CHANGED
|
@@ -189,29 +189,6 @@ const media = await playerRef.current?.getMediaInfo();
|
|
|
189
189
|
- `getCurrentTrackIds()`
|
|
190
190
|
- `getMediaInfo()` — returns codec, resolution, fps, bitrate, hwdec status, pixel format, colorspace
|
|
191
191
|
|
|
192
|
-
### API changes
|
|
193
|
-
|
|
194
|
-
If you used an earlier iOS-only version, this release adds and/or formalizes:
|
|
195
|
-
|
|
196
|
-
- Android support
|
|
197
|
-
- `hwdec` prop for platform-specific hardware decode control
|
|
198
|
-
- `stop()`
|
|
199
|
-
- `removeSubtitle(trackId)`
|
|
200
|
-
- `reloadSubtitles()`
|
|
201
|
-
- `setPropertyString(name, value)`
|
|
202
|
-
- `getCurrentTrackIds()`
|
|
203
|
-
- `getMediaInfo()` for codec, resolution, fps, bitrate, hwdec status
|
|
204
|
-
|
|
205
|
-
The README examples now assume the shared iOS/Android API surface rather than an iOS-only integration flow.
|
|
206
|
-
|
|
207
|
-
### Migration notes
|
|
208
|
-
|
|
209
|
-
- Add `"expo-mpv"` to your Expo plugins list if you previously relied on manual native setup
|
|
210
|
-
- Keep `expo-build-properties` for the iOS 16 deployment target
|
|
211
|
-
- Re-run `npx expo prebuild` after upgrading so the plugin can wire native changes into both platforms
|
|
212
|
-
- Android native dependencies are now fetched as part of the build, so CI should allow Gradle network access on first build
|
|
213
|
-
- If you wrapped the player with platform checks because Android was unsupported, you can simplify that logic once your Android app is configured
|
|
214
|
-
|
|
215
192
|
## CJK Subtitle Rendering
|
|
216
193
|
|
|
217
194
|
This module bundles [Noto Sans CJK SC](https://github.com/notofonts/noto-cjk) (SIL Open Font License) for Chinese/Japanese/Korean subtitle rendering.
|
|
@@ -242,18 +219,6 @@ React Native (JS)
|
|
|
242
219
|
|
|
243
220
|
On simulator, `vo=gpu` is used instead of `vo=gpu-next` to avoid a crash in `MTLSimDriver` caused by XPC shared memory size limits when libplacebo uploads video frame textures.
|
|
244
221
|
|
|
245
|
-
## License transition
|
|
246
|
-
|
|
247
|
-
This project is now licensed under `GPL-3.0-only` instead of MIT.
|
|
248
|
-
|
|
249
|
-
That means:
|
|
250
|
-
|
|
251
|
-
- source code and derivative distributions must remain under GPLv3-compatible terms
|
|
252
|
-
- if you redistribute a modified version, you must also provide the corresponding source under GPLv3
|
|
253
|
-
- downstream consumers should review compatibility before bundling this module into closed-source products
|
|
254
|
-
|
|
255
|
-
Bundled third-party assets and dependencies may carry their own licenses. For example, the bundled Noto font remains under the SIL Open Font License.
|
|
256
|
-
|
|
257
222
|
## License
|
|
258
223
|
|
|
259
224
|
[GPL-3.0](./LICENSE)
|
|
@@ -3,6 +3,7 @@ package expo.modules.mpv
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.app.Application
|
|
5
5
|
import android.content.Context
|
|
6
|
+
import android.os.Build
|
|
6
7
|
import android.os.Bundle
|
|
7
8
|
import android.os.Handler
|
|
8
9
|
import android.os.Looper
|
|
@@ -30,7 +31,7 @@ class ExpoMpvView(context: Context, appContext: AppContext) : ExpoView(context,
|
|
|
30
31
|
private var nativePtr: Long = 0
|
|
31
32
|
private var isInitialized = false
|
|
32
33
|
private var pendingSource: String? = null
|
|
33
|
-
private var pendingHwdec: String = "mediacodec"
|
|
34
|
+
private var pendingHwdec: String = if (isEmulator()) "no" else "mediacodec"
|
|
34
35
|
private val mainHandler = Handler(Looper.getMainLooper())
|
|
35
36
|
private var progressRunnable: Runnable? = null
|
|
36
37
|
|
|
@@ -145,7 +146,13 @@ class ExpoMpvView(context: Context, appContext: AppContext) : ExpoView(context,
|
|
|
145
146
|
MPVLib.nativeSetOptionString(nativePtr, "vo", "gpu")
|
|
146
147
|
MPVLib.nativeSetOptionString(nativePtr, "gpu-context", "android")
|
|
147
148
|
MPVLib.nativeSetOptionString(nativePtr, "hwdec", pendingHwdec)
|
|
148
|
-
|
|
149
|
+
if (pendingHwdec != "no") {
|
|
150
|
+
MPVLib.nativeSetOptionString(nativePtr, "hwdec-codecs", "h264,hevc,mpeg4,mpeg2video,vp8,vp9,av1")
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (isEmulator()) {
|
|
154
|
+
android.util.Log.w("ExpoMpv", "Emulator detected, hardware decoding disabled (using software decoding)")
|
|
155
|
+
}
|
|
149
156
|
|
|
150
157
|
// General
|
|
151
158
|
MPVLib.nativeSetOptionString(nativePtr, "force-window", "yes")
|
|
@@ -455,4 +462,24 @@ class ExpoMpvView(context: Context, appContext: AppContext) : ExpoView(context,
|
|
|
455
462
|
if (nativePtr == 0L) return
|
|
456
463
|
MPVLib.nativeCommand(nativePtr, (listOf(cmd) + args).toTypedArray())
|
|
457
464
|
}
|
|
465
|
+
|
|
466
|
+
companion object {
|
|
467
|
+
private fun isEmulator(): Boolean {
|
|
468
|
+
return (Build.FINGERPRINT.startsWith("generic")
|
|
469
|
+
|| Build.FINGERPRINT.startsWith("unknown")
|
|
470
|
+
|| Build.MODEL.contains("google_sdk")
|
|
471
|
+
|| Build.MODEL.contains("Emulator")
|
|
472
|
+
|| Build.MODEL.contains("Android SDK built for x86")
|
|
473
|
+
|| Build.BOARD == "QC_Reference_Phone"
|
|
474
|
+
|| Build.MANUFACTURER.contains("Genymotion")
|
|
475
|
+
|| Build.HOST.startsWith("Build")
|
|
476
|
+
|| Build.BRAND.startsWith("generic")
|
|
477
|
+
|| Build.DEVICE.startsWith("generic")
|
|
478
|
+
|| Build.PRODUCT == "google_sdk"
|
|
479
|
+
|| Build.PRODUCT.startsWith("sdk")
|
|
480
|
+
|| Build.PRODUCT.endsWith("_cf")
|
|
481
|
+
|| Build.HARDWARE.contains("goldfish")
|
|
482
|
+
|| Build.HARDWARE.contains("ranchu"))
|
|
483
|
+
}
|
|
484
|
+
}
|
|
458
485
|
}
|