[Android] Check if ML is started instead of initialized

Geoffrey Métais git at videolan.org
Fri Oct 12 14:28:31 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Oct 12 11:55:24 2018 +0200| [02cb8513e9dc433de9f7abcb07b7126fb99dc8b6] | committer: Geoffrey Métais

Check if ML is started instead of initialized

> https://code.videolan.org/videolan/vlc-android/commit/02cb8513e9dc433de9f7abcb07b7126fb99dc8b6
---

 vlc-android/src/org/videolan/vlc/util/Kextensions.kt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
index 19abbc046..14565a5ab 100644
--- a/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
+++ b/vlc-android/src/org/videolan/vlc/util/Kextensions.kt
@@ -8,7 +8,6 @@ import android.support.v4.app.Fragment
 import android.support.v4.app.FragmentActivity
 import android.support.v7.preference.PreferenceManager
 import kotlinx.coroutines.experimental.Dispatchers
-import kotlinx.coroutines.experimental.IO
 import kotlinx.coroutines.experimental.delay
 import kotlinx.coroutines.experimental.withContext
 import org.videolan.libvlc.Media
@@ -66,7 +65,7 @@ fun Long.random() = (Random().nextFloat() * this).toLong()
 
 suspend inline fun <reified T> Context.getFromMl(crossinline block: Medialibrary.() -> T) = withContext(Dispatchers.IO) {
     val ml = Medialibrary.getInstance()
-    if (ml.isInitiated) block.invoke(ml)
+    if (ml.isStarted) block.invoke(ml)
     else suspendCoroutine { continuation ->
         ml.addOnMedialibraryReadyListener(object : Medialibrary.OnMedialibraryReadyListener {
             override fun onMedialibraryReady() {



More information about the Android mailing list