@simba-dev/react-native-media-player 3.4.0 → 3.5.0
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/CHANGELOG.md +33 -0
- package/android/src/main/cpp/event.cpp +11 -122
- package/android/src/main/cpp/main.cpp +185 -141
- package/android/src/main/cpp/native_state.cpp +271 -25
- package/android/src/main/cpp/native_state.h +39 -0
- package/android/src/main/cpp/property.cpp +14 -75
- package/android/src/main/java/com/simba/player/mpv/MPVLib.kt +25 -0
- package/android/src/main/java/com/simba/player/mpv/MpvBridgeModule.kt +64 -2
- package/package.json +1 -1
- package/src/bridge/MpvPlayerModule.ts +32 -0
- package/src/bridge/NativeMpvPlayer.ts +4 -0
- package/src/hooks/useLaunchPlayback.ts +3 -1
|
@@ -110,6 +110,13 @@ export interface LaunchParams {
|
|
|
110
110
|
* `loadFileWithRequestId`, which already exists for the same reason.
|
|
111
111
|
*/
|
|
112
112
|
readonly requestId?: string;
|
|
113
|
+
/**
|
|
114
|
+
* HTTP request headers to send when fetching THIS file.
|
|
115
|
+
*
|
|
116
|
+
* They are per file: the native side turns them into mpv¤s per-file
|
|
117
|
+
* options, so they apply to this launch and to no later one.
|
|
118
|
+
*/
|
|
119
|
+
readonly headers?: Record<string, string>;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
/**
|
|
@@ -596,6 +603,24 @@ export interface MpvPlayerModuleBridge {
|
|
|
596
603
|
setDebugLogging(enabled: boolean): void;
|
|
597
604
|
/** Dump all observed mpv properties to logcat. Returns the count. */
|
|
598
605
|
dumpObservedProperties(): number;
|
|
606
|
+
|
|
607
|
+
// ── Hardware-adaptive performance tuning (v3.5.0) ──────────────────────
|
|
608
|
+
/**
|
|
609
|
+
* Switch the native libmpv GPU/scaler/cache tier at runtime:
|
|
610
|
+
* `'auto' | 'low' | 'mid' | 'high' | 'battery-saver' | 'balanced' | 'high-quality'`.
|
|
611
|
+
*/
|
|
612
|
+
setPerformanceProfile(
|
|
613
|
+
profile:
|
|
614
|
+
| 'auto'
|
|
615
|
+
| 'low'
|
|
616
|
+
| 'mid'
|
|
617
|
+
| 'high'
|
|
618
|
+
| 'battery-saver'
|
|
619
|
+
| 'balanced'
|
|
620
|
+
| 'high-quality',
|
|
621
|
+
): void;
|
|
622
|
+
/** Return the active C++ hardware profile as a JSON string. */
|
|
623
|
+
getHardwareProfile(): string;
|
|
599
624
|
}
|
|
600
625
|
|
|
601
626
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -840,6 +865,13 @@ const NOOP_BRIDGE: MpvPlayerModuleBridge = {
|
|
|
840
865
|
void _enabled;
|
|
841
866
|
},
|
|
842
867
|
dumpObservedProperties: () => 0,
|
|
868
|
+
|
|
869
|
+
// Hardware-adaptive performance tuning
|
|
870
|
+
setPerformanceProfile: (_profile: string) => {
|
|
871
|
+
void _profile;
|
|
872
|
+
},
|
|
873
|
+
getHardwareProfile: () =>
|
|
874
|
+
'{"tier":"mid","totalRamMb":0,"cpuCores":0,"screenWidthPx":0,"screenHeightPx":0,"glEsMajor":3,"isLowRam":false}',
|
|
843
875
|
};
|
|
844
876
|
|
|
845
877
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -367,6 +367,10 @@ export interface Spec extends TurboModule {
|
|
|
367
367
|
setDebugLogging(enabled: boolean): void;
|
|
368
368
|
dumpObservedProperties(): number;
|
|
369
369
|
|
|
370
|
+
// ── Hardware-adaptive performance tuning (v3.5.0) ──────────────────────
|
|
371
|
+
setPerformanceProfile(profile: string): void;
|
|
372
|
+
getHardwareProfile(): string;
|
|
373
|
+
|
|
370
374
|
// ── Event emitter plumbing (React Native's NativeEventEmitter) ─────────
|
|
371
375
|
//
|
|
372
376
|
// React Native's `NativeEventEmitter` REQUIRES the native module to
|
|
@@ -90,7 +90,9 @@ export function useLaunchPlayback(
|
|
|
90
90
|
// `loadAndPlay` owns the title-then-load ordering now, shared
|
|
91
91
|
// with `usePlayerActivity.openPlayer` so the two entry points
|
|
92
92
|
// cannot drift into loading a file under the wrong title.
|
|
93
|
-
|
|
93
|
+
// The headers ride the LOAD. They are part of the file being
|
|
94
|
+
// opened, not a property set before it.
|
|
95
|
+
loadAndPlay(bridge, {uri, title, startPositionMs, headers: launchParams?.headers});
|
|
94
96
|
} catch {
|
|
95
97
|
// Bridge not present (jest/web) — ignore.
|
|
96
98
|
}
|