expo-libmpv 0.3.12 → 0.4.1
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/android/build.gradle +1 -1
- package/android/src/main/java/com/libmpv/LibmpvView.kt +15 -9
- package/android/src/main/java/com/libmpv/LibmpvViewModule.kt +7 -0
- package/build/LibmpvView.d.ts.map +1 -1
- package/build/LibmpvView.js +1 -1
- package/build/LibmpvView.js.map +1 -1
- package/build/LibmpvViewTypes.d.ts +1 -0
- package/build/LibmpvViewTypes.d.ts.map +1 -1
- package/build/LibmpvViewTypes.js.map +1 -1
- package/package.json +1 -1
- package/src/LibmpvView.tsx +1 -0
- package/src/LibmpvViewTypes.ts +1 -0
package/android/build.gradle
CHANGED
|
@@ -38,6 +38,7 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
38
38
|
var audioIndex: Int? = null
|
|
39
39
|
var subtitleIndex: Int? = null
|
|
40
40
|
var useHardwareDecoder: Boolean? = null
|
|
41
|
+
var videoOutput: String? = null
|
|
41
42
|
|
|
42
43
|
init {
|
|
43
44
|
surfaceView.holder.addCallback(this)
|
|
@@ -69,7 +70,8 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
69
70
|
surfaceHeight != null &&
|
|
70
71
|
audioIndex != null &&
|
|
71
72
|
subtitleIndex != null &&
|
|
72
|
-
useHardwareDecoder != null
|
|
73
|
+
useHardwareDecoder != null &&
|
|
74
|
+
videoOutput != null
|
|
73
75
|
|
|
74
76
|
if (allPropsReady) {
|
|
75
77
|
log("LibmpvView.attemptCreation", "Initializing MPV instance")
|
|
@@ -112,7 +114,8 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
112
114
|
mpv.setOptionString("msg-level", "all=no")
|
|
113
115
|
|
|
114
116
|
mpv.setOptionString("profile", "fast")
|
|
115
|
-
|
|
117
|
+
|
|
118
|
+
videoOutput?.let { mpv.setOptionString("vo", it) }
|
|
116
119
|
|
|
117
120
|
if (useHardwareDecoder == true) {
|
|
118
121
|
mpv.setOptionString("hwdec", HARDWARE_OPTIONS)
|
|
@@ -123,7 +126,15 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
123
126
|
|
|
124
127
|
mpv.setOptionString("gpu-context", "android")
|
|
125
128
|
mpv.setOptionString("opengl-es", "yes")
|
|
126
|
-
|
|
129
|
+
|
|
130
|
+
// Nearly all of this block is to prevent choppy playback on Google streaming devices
|
|
131
|
+
mpv.setOptionString("video-sync", "audio")
|
|
132
|
+
mpv.setOptionString("audio-pitch-correction","yes")
|
|
133
|
+
mpv.setOptionString("scale", "bilinear")
|
|
134
|
+
mpv.setOptionString("dscale", "bilinear")
|
|
135
|
+
mpv.setOptionString("interpolation","no")
|
|
136
|
+
mpv.setOptionString("tscale","off")
|
|
137
|
+
mpv.setOptionString("correct-pts","yes")
|
|
127
138
|
|
|
128
139
|
mpv.setOptionString("ao", "audiotrack")
|
|
129
140
|
mpv.setOptionString("alang", "")
|
|
@@ -135,8 +146,6 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
135
146
|
|
|
136
147
|
mpv.setOptionString("cache", "yes")
|
|
137
148
|
mpv.setOptionString("cache-pause-initial", "yes")
|
|
138
|
-
mpv.setOptionString("cache-secs", "5")
|
|
139
|
-
mpv.setOptionString("demuxer-readahead-secs", "5")
|
|
140
149
|
}
|
|
141
150
|
|
|
142
151
|
fun log(method: String, argument: String) {
|
|
@@ -179,12 +188,9 @@ class LibmpvView(context: Context, appContext: AppContext) :
|
|
|
179
188
|
val width = surfaceWidth ?: 0
|
|
180
189
|
val height = surfaceHeight ?: 0
|
|
181
190
|
|
|
182
|
-
// In the new Fabric version, this is stretching the content
|
|
183
|
-
//holder.setFixedSize(width, height)
|
|
184
|
-
//mpv.setPropertyString("android-surface-size", "${width}x${height}")
|
|
185
|
-
|
|
186
191
|
mpv.attachSurface(surfaceView)
|
|
187
192
|
prepareMpvPlayback()
|
|
193
|
+
mpv.setOptionString("vf", "scale=${width}:${height}")
|
|
188
194
|
isSurfaceCreated = true
|
|
189
195
|
log("LibmpvView.surfaceCreated", "Surface created and MPV should be playing")
|
|
190
196
|
}
|
|
@@ -22,6 +22,13 @@ class LibmpvViewModule : Module() {
|
|
|
22
22
|
view.cleanup()
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
Prop("videoOutput") { view: LibmpvView, videoOutput: String ->
|
|
26
|
+
view.videoOutput = videoOutput
|
|
27
|
+
view.setVideoOutput(videoOutput)
|
|
28
|
+
view.attemptCreation()
|
|
29
|
+
view.log("setVideoOutput", videoOutput)
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
Prop("playUrl") { view: LibmpvView, playUrl: String ->
|
|
26
33
|
view.playUrl = playUrl
|
|
27
34
|
if (view.isSurfaceReady()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibmpvView.d.ts","sourceRoot":"","sources":["../src/LibmpvView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAkC7E,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"LibmpvView.d.ts","sourceRoot":"","sources":["../src/LibmpvView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAkC7E,eAAO,MAAM,UAAU,8GAuDrB,CAAA;AAEF,eAAe,UAAU,CAAA"}
|
package/build/LibmpvView.js
CHANGED
|
@@ -67,7 +67,7 @@ export const LibmpvView = React.forwardRef((props, parentRef) => {
|
|
|
67
67
|
// The order props are handled in the native code is non-deterministic
|
|
68
68
|
// Each native prop setter checks to see if all required props are set
|
|
69
69
|
// Only then will it try to create an instance of mpv
|
|
70
|
-
return <LibmpvViewNative ref={parentRef} style={props.surfaceStyle ? props.surfaceStyle : styles.videoPlayer} playUrl={props.playUrl} isPlaying={props.isPlaying} useHardwareDecoder={props.useHardwareDecoder} surfaceWidth={props.surfaceWidth} surfaceHeight={props.surfaceHeight} selectedAudioTrack={props.selectedAudioTrack} selectedSubtitleTrack={props.selectedSubtitleTrack} seekToSeconds={props.seekToSeconds} onLibmpvEvent={onLogEvent} onLibmpvLog={onLibmpvLog}/>;
|
|
70
|
+
return <LibmpvViewNative ref={parentRef} style={props.surfaceStyle ? props.surfaceStyle : styles.videoPlayer} videoOutput={props.videoOutput} playUrl={props.playUrl} isPlaying={props.isPlaying} useHardwareDecoder={props.useHardwareDecoder} surfaceWidth={props.surfaceWidth} surfaceHeight={props.surfaceHeight} selectedAudioTrack={props.selectedAudioTrack} selectedSubtitleTrack={props.selectedSubtitleTrack} seekToSeconds={props.seekToSeconds} onLibmpvEvent={onLogEvent} onLibmpvLog={onLibmpvLog}/>;
|
|
71
71
|
});
|
|
72
72
|
export default LibmpvView;
|
|
73
73
|
//# sourceMappingURL=LibmpvView.js.map
|
package/build/LibmpvView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibmpvView.js","sourceRoot":"","sources":["../src/LibmpvView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,GAAQ;IAClB,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;CACF,CAAC;AAEF,MAAM,YAAY,GAAQ;IACxB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,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,EACzB,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,eAAe,UAAU,CAAA","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { LibmpvViewProps, LibmpvViewNativeMethods } from './LibmpvViewTypes';\n\nconst styles: any = {\n videoPlayer: {\n position: \"absolute\",\n left: 0,\n bottom: 0,\n right: 0,\n top: 0\n }\n};\n\nconst EVENT_LOOKUP: any = {\n 0: 'NONE',\n 1: 'SHUTDOWN',\n 2: 'LOG_MESSAGE',\n 3: 'GET_PROPERTY_REPLY',\n 4: 'SET_PROPERTY_REPLY',\n 5: 'COMMAND_REPLY',\n 6: 'START_FILE',\n 7: 'END_FILE',\n 8: 'FILE_LOADED',\n 16: 'CLIENT_MESSAGE',\n 17: 'VIDEO_RECONFIG',\n 18: 'AUDIO_RECONFIG',\n 20: 'SEEK',\n 21: 'PLAYBACK_RESTART',\n 22: 'PROPERTY_CHANGE',\n 24: 'QUEUE_OVERFLOW',\n 25: 'HOOK'\n}\n\nconst LibmpvViewNative: React.ComponentType<LibmpvViewProps> = requireNativeView('LibmpvView');\n\nexport const LibmpvView = React.forwardRef<LibmpvViewNativeMethods, LibmpvViewProps>((props: any, parentRef: any) => {\n React.useEffect(() => {\n return () => {\n if (parentRef?.current?.cleanup) {\n parentRef.current.cleanup();\n }\n };\n }, []);\n\n // Pass mpv events and logs back up to the parent\n const onLogEvent = (libmpvEvent: any) => {\n if (props.onLibmpvEvent) {\n if (libmpvEvent && libmpvEvent.nativeEvent) {\n libmpvEvent = libmpvEvent.nativeEvent\n }\n if (libmpvEvent.eventId) {\n libmpvEvent.value = parseInt(libmpvEvent.eventId, 10)\n libmpvEvent.eventKind = EVENT_LOOKUP[libmpvEvent.eventId]\n }\n else if (libmpvEvent.kind === 'long' || libmpvEvent.kind === 'double') {\n libmpvEvent.value = Number(libmpvEvent.value)\n }\n else if (libmpvEvent.kind === 'boolean') {\n libmpvEvent.value = libmpvEvent.value === 'true'\n }\n return props.onLibmpvEvent(libmpvEvent)\n }\n }\n const onLibmpvLog = (libmpvLog: any) => {\n if (props.onLibmpvLog) {\n if (libmpvLog && libmpvLog.nativeEvent) {\n libmpvLog = libmpvLog.nativeEvent\n }\n return props.onLibmpvLog(libmpvLog);\n }\n }\n\n // The order props are handled in the native code is non-deterministic\n // Each native prop setter checks to see if all required props are set\n // Only then will it try to create an instance of mpv\n return <LibmpvViewNative\n ref={parentRef}\n style={props.surfaceStyle ? props.surfaceStyle : styles.videoPlayer}\n playUrl={props.playUrl}\n isPlaying={props.isPlaying}\n useHardwareDecoder={props.useHardwareDecoder}\n surfaceWidth={props.surfaceWidth}\n surfaceHeight={props.surfaceHeight}\n selectedAudioTrack={props.selectedAudioTrack}\n selectedSubtitleTrack={props.selectedSubtitleTrack}\n seekToSeconds={props.seekToSeconds}\n onLibmpvEvent={onLogEvent}\n onLibmpvLog={onLibmpvLog}\n />\n})\n\nexport default LibmpvView"]}
|
|
1
|
+
{"version":3,"file":"LibmpvView.js","sourceRoot":"","sources":["../src/LibmpvView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,GAAQ;IAClB,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;CACF,CAAC;AAEF,MAAM,YAAY,GAAQ;IACxB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,aAAa;IAChB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,oBAAoB;IACvB,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,aAAa;IAChB,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,gBAAgB;IACpB,EAA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esContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { LibmpvViewProps, LibmpvViewNativeMethods } from './LibmpvViewTypes';\n\nconst styles: any = {\n videoPlayer: {\n position: \"absolute\",\n left: 0,\n bottom: 0,\n right: 0,\n top: 0\n }\n};\n\nconst EVENT_LOOKUP: any = {\n 0: 'NONE',\n 1: 'SHUTDOWN',\n 2: 'LOG_MESSAGE',\n 3: 'GET_PROPERTY_REPLY',\n 4: 'SET_PROPERTY_REPLY',\n 5: 'COMMAND_REPLY',\n 6: 'START_FILE',\n 7: 'END_FILE',\n 8: 'FILE_LOADED',\n 16: 'CLIENT_MESSAGE',\n 17: 'VIDEO_RECONFIG',\n 18: 'AUDIO_RECONFIG',\n 20: 'SEEK',\n 21: 'PLAYBACK_RESTART',\n 22: 'PROPERTY_CHANGE',\n 24: 'QUEUE_OVERFLOW',\n 25: 'HOOK'\n}\n\nconst LibmpvViewNative: React.ComponentType<LibmpvViewProps> = requireNativeView('LibmpvView');\n\nexport const LibmpvView = React.forwardRef<LibmpvViewNativeMethods, LibmpvViewProps>((props: any, parentRef: any) => {\n React.useEffect(() => {\n return () => {\n if (parentRef?.current?.cleanup) {\n parentRef.current.cleanup();\n }\n };\n }, []);\n\n // Pass mpv events and logs back up to the parent\n const onLogEvent = (libmpvEvent: any) => {\n if (props.onLibmpvEvent) {\n if (libmpvEvent && libmpvEvent.nativeEvent) {\n libmpvEvent = libmpvEvent.nativeEvent\n }\n if (libmpvEvent.eventId) {\n libmpvEvent.value = parseInt(libmpvEvent.eventId, 10)\n libmpvEvent.eventKind = EVENT_LOOKUP[libmpvEvent.eventId]\n }\n else if (libmpvEvent.kind === 'long' || libmpvEvent.kind === 'double') {\n libmpvEvent.value = Number(libmpvEvent.value)\n }\n else if (libmpvEvent.kind === 'boolean') {\n libmpvEvent.value = libmpvEvent.value === 'true'\n }\n return props.onLibmpvEvent(libmpvEvent)\n }\n }\n const onLibmpvLog = (libmpvLog: any) => {\n if (props.onLibmpvLog) {\n if (libmpvLog && libmpvLog.nativeEvent) {\n libmpvLog = libmpvLog.nativeEvent\n }\n return props.onLibmpvLog(libmpvLog);\n }\n }\n\n // The order props are handled in the native code is non-deterministic\n // Each native prop setter checks to see if all required props are set\n // Only then will it try to create an instance of mpv\n return <LibmpvViewNative\n ref={parentRef}\n style={props.surfaceStyle ? props.surfaceStyle : styles.videoPlayer}\n videoOutput={props.videoOutput}\n playUrl={props.playUrl}\n isPlaying={props.isPlaying}\n useHardwareDecoder={props.useHardwareDecoder}\n surfaceWidth={props.surfaceWidth}\n surfaceHeight={props.surfaceHeight}\n selectedAudioTrack={props.selectedAudioTrack}\n selectedSubtitleTrack={props.selectedSubtitleTrack}\n seekToSeconds={props.seekToSeconds}\n onLibmpvEvent={onLogEvent}\n onLibmpvLog={onLibmpvLog}\n />\n})\n\nexport default LibmpvView"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibmpvViewTypes.d.ts","sourceRoot":"","sources":["../src/LibmpvViewTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,eAAe,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E,CAAC"}
|
|
1
|
+
{"version":3,"file":"LibmpvViewTypes.d.ts","sourceRoot":"","sources":["../src/LibmpvViewTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,EAAE,GAAG,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,eAAe,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibmpvViewTypes.js","sourceRoot":"","sources":["../src/LibmpvViewTypes.ts"],"names":[],"mappings":"","sourcesContent":["export type LibmpvViewProps = {\n ref: any,\n style: any,\n playUrl: string,\n isPlaying: boolean,\n useHardwareDecoder: boolean,\n selectedAudioTrack: number,\n selectedSubtitleTrack: number,\n seekToSeconds: number,\n surfaceWidth: number,\n surfaceHeight: number,\n onLibmpvEvent: (libmpvEvent: any) => void,\n onLibmpvLog: (libmpvLog: any) => void,\n};\n\nexport type LibmpvViewNativeMethods = {\n runCommand: (pipeDelimitedArguments: string) => void | Promise<void>;\n setOptionString: (pipeDelimitedArguments: string) => void | Promise<void>;\n};"]}
|
|
1
|
+
{"version":3,"file":"LibmpvViewTypes.js","sourceRoot":"","sources":["../src/LibmpvViewTypes.ts"],"names":[],"mappings":"","sourcesContent":["export type LibmpvViewProps = {\n ref: any,\n style: any,\n videoOutput: string,\n playUrl: string,\n isPlaying: boolean,\n useHardwareDecoder: boolean,\n selectedAudioTrack: number,\n selectedSubtitleTrack: number,\n seekToSeconds: number,\n surfaceWidth: number,\n surfaceHeight: number,\n onLibmpvEvent: (libmpvEvent: any) => void,\n onLibmpvLog: (libmpvLog: any) => void,\n};\n\nexport type LibmpvViewNativeMethods = {\n runCommand: (pipeDelimitedArguments: string) => void | Promise<void>;\n setOptionString: (pipeDelimitedArguments: string) => void | Promise<void>;\n};"]}
|
package/package.json
CHANGED
package/src/LibmpvView.tsx
CHANGED
|
@@ -77,6 +77,7 @@ export const LibmpvView = React.forwardRef<LibmpvViewNativeMethods, LibmpvViewPr
|
|
|
77
77
|
return <LibmpvViewNative
|
|
78
78
|
ref={parentRef}
|
|
79
79
|
style={props.surfaceStyle ? props.surfaceStyle : styles.videoPlayer}
|
|
80
|
+
videoOutput={props.videoOutput}
|
|
80
81
|
playUrl={props.playUrl}
|
|
81
82
|
isPlaying={props.isPlaying}
|
|
82
83
|
useHardwareDecoder={props.useHardwareDecoder}
|