expo-libmpv 0.5.5 → 0.5.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.
@@ -299,7 +299,6 @@ class LibmpvRenderer(
299
299
  try {
300
300
  loadedUrl = url
301
301
  MPVLib.command(arrayOf("loadfile", url, "replace"))
302
- applyContinuousState()
303
302
  } catch (e: Exception) {
304
303
  logException(e)
305
304
  }
@@ -319,22 +318,24 @@ class LibmpvRenderer(
319
318
  }
320
319
 
321
320
  private fun applyDeferredState() {
322
- if (!mpvAlive || shuttingDown) {
321
+ if (!session.hasFileLoaded || !surfaceAttached || state != State.ACTIVE) {
323
322
  return
324
323
  }
325
324
 
326
325
  session.seekToSeconds?.let { target ->
327
326
  if (session.needsApply(LibmpvSession.MpvIntent.SEEK)) {
328
- val timePos = MPVLib.getPropertyDouble("time-pos")
329
327
  val seekable = MPVLib.getPropertyBoolean("seekable") == true
330
328
 
331
- if (seekable && timePos != null && kotlin.math.abs(timePos - target) > 0.5) {
329
+ if (seekable && surfaceAttached && state == State.ACTIVE) {
330
+ MPVLib.command(arrayOf("set", "pause", "yes"))
332
331
  MPVLib.command(arrayOf("seek", target.toString(), "absolute"))
332
+ MPVLib.command(arrayOf("set", "pause", if (session.isPlaying) "no" else "yes"))
333
333
  session.markApplied(LibmpvSession.MpvIntent.SEEK)
334
334
  }
335
335
  }
336
336
  }
337
337
 
338
+
338
339
  session.selectedAudioTrack?.let {
339
340
  if (session.needsApply(LibmpvSession.MpvIntent.AUDIO_TRACK)) {
340
341
  val aid = if (it == -1) "no" else (it + 1).toString()
@@ -382,7 +383,10 @@ class LibmpvRenderer(
382
383
 
383
384
  override fun event(eventId: Int) {
384
385
  when (eventId) {
385
- MPVLib.MpvEvent.MPV_EVENT_FILE_LOADED,
386
+ MPVLib.MpvEvent.MPV_EVENT_FILE_LOADED -> {
387
+ session.hasFileLoaded = true
388
+ }
389
+
386
390
  MPVLib.MpvEvent.MPV_EVENT_PLAYBACK_RESTART -> {
387
391
  session.hasFileLoaded = true
388
392
  applyDeferredState()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-libmpv",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "A libmpv Fabric component for Android",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -28,11 +28,11 @@
28
28
  "license": "MIT",
29
29
  "homepage": "https://github.com/XBigTK13X/expo-libmpv#readme",
30
30
  "dependencies": {
31
- "expo-build-properties": "1.0.9"
31
+ "expo-build-properties": "1.0.10"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/react": "~19.1.10",
35
- "expo": "54.0.21",
35
+ "expo": "54.0.29",
36
36
  "expo-module-scripts": "^4.1.10",
37
37
  "react": "19.1.0",
38
38
  "react-native": "0.81.5"