expo-libmpv 0.5.7 → 0.5.9

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.
@@ -295,13 +295,6 @@ class LibmpvRenderer(
295
295
 
296
296
  try {
297
297
  loadedUrl = url
298
- MPVLib.setOptionString("start", "0")
299
-
300
- val start = session.seekToSeconds
301
- if (start != null) {
302
- MPVLib.setOptionString("start", start.toLong().toString())
303
- }
304
-
305
298
  MPVLib.command(
306
299
  arrayOf(
307
300
  "loadfile",
@@ -354,19 +347,22 @@ class LibmpvRenderer(
354
347
  }
355
348
  }
356
349
 
357
- if (session.needsApply(LibmpvSession.MpvIntent.SEEK)) {
358
- val target = session.seekToSeconds
359
- if (target != null) {
350
+ session.seekToSeconds?.let { seekToSeconds ->
351
+ if (
352
+ session.needsApply(LibmpvSession.MpvIntent.SEEK) &&
353
+ session.hasFileLoaded
354
+ ) {
360
355
  MPVLib.command(
361
356
  arrayOf(
362
357
  "seek",
363
- target.toString(),
358
+ seekToSeconds.toString(),
364
359
  "absolute"
365
360
  )
366
361
  )
367
362
  session.markApplied(LibmpvSession.MpvIntent.SEEK)
368
363
  }
369
364
  }
365
+
370
366
  }
371
367
 
372
368
  private fun stopPlayback() {
@@ -395,10 +391,7 @@ class LibmpvRenderer(
395
391
 
396
392
  override fun event(eventId: Int) {
397
393
  when (eventId) {
398
- MPVLib.MpvEvent.MPV_EVENT_FILE_LOADED -> {
399
- session.hasFileLoaded = true
400
- }
401
-
394
+ MPVLib.MpvEvent.MPV_EVENT_FILE_LOADED,
402
395
  MPVLib.MpvEvent.MPV_EVENT_PLAYBACK_RESTART -> {
403
396
  session.hasFileLoaded = true
404
397
  applyDeferredState()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-libmpv",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "A libmpv Fabric component for Android",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",