Fixed not starting at the correct posistion when playing video

This commit is contained in:
Alex Kim
2024-11-18 04:24:58 +11:00
parent 991f58cf73
commit 34d7ab5f1e

View File

@@ -50,7 +50,7 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
val uri = source["uri"] as? String val uri = source["uri"] as? String
val autoplay = source["autoplay"] as? Boolean ?: false val autoplay = source["autoplay"] as? Boolean ?: false
val isNetwork = source["isNetwork"] as? Boolean ?: false val isNetwork = source["isNetwork"] as? Boolean ?: false
startPosition = source["startPosition"] as? Int ?: 0 startPosition = (source["startPosition"] as? Double)?.toInt() ?: 0
// Handle video load start event // Handle video load start event
// onVideoLoadStart?.invoke(mapOf("target" to reactTag ?: "null")) // onVideoLoadStart?.invoke(mapOf("target" to reactTag ?: "null"))
@@ -149,6 +149,7 @@ class VlcPlayerView(context: Context, appContext: AppContext) : ExpoView(context
override fun onDetachedFromWindow() { override fun onDetachedFromWindow() {
super.onDetachedFromWindow() super.onDetachedFromWindow()
mediaPlayer?.release() mediaPlayer?.release()
mediaPlayer = null
libVLC?.release() libVLC?.release()
} }