[Android] Update ML libvlc instance when it's restarted from app

Nicolas Pomepuy git at videolan.org
Thu Jun 10 09:40:57 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Mar 16 07:38:28 2021 +0100| [47d74ff2ebaeab8e16895e4900defbb9cd53b50a] | committer: Nicolas Pomepuy

Update ML libvlc instance when it's restarted from app

> https://code.videolan.org/videolan/vlc-android/commit/47d74ff2ebaeab8e16895e4900defbb9cd53b50a
---

 .../resources/src/main/java/org/videolan/resources/VLCInstance.kt      | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/application/resources/src/main/java/org/videolan/resources/VLCInstance.kt b/application/resources/src/main/java/org/videolan/resources/VLCInstance.kt
index 307a4966b..13658eea5 100644
--- a/application/resources/src/main/java/org/videolan/resources/VLCInstance.kt
+++ b/application/resources/src/main/java/org/videolan/resources/VLCInstance.kt
@@ -27,12 +27,14 @@ import android.content.Intent
 import android.util.Log
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import org.videolan.libvlc.FactoryManager
+import org.videolan.libvlc.LibVLC
 import org.videolan.libvlc.interfaces.ILibVLC
 import org.videolan.libvlc.interfaces.ILibVLCFactory
 import org.videolan.libvlc.util.VLCUtil
 import org.videolan.resources.VLCInstance.init
 import org.videolan.resources.util.VLCCrashHandler
 import org.videolan.tools.SingletonHolder
+import org.videolan.medialibrary.interfaces.Medialibrary
 
 @ObsoleteCoroutinesApi
 object VLCInstance : SingletonHolder<ILibVLC, Context>({ init(it.applicationContext) }) {
@@ -62,6 +64,7 @@ object VLCInstance : SingletonHolder<ILibVLC, Context>({ init(it.applicationCont
         sLibVLC.release()
         sLibVLC = libVLCFactory.getFromOptions(AppContextProvider.appContext, VLCOptions.libOptions)
         instance = sLibVLC
+        Medialibrary.getInstance().setLibVLCInstance((sLibVLC as LibVLC).getInstance())
     }
 
     fun testCompatibleCPU(context: Context): Boolean {



More information about the Android mailing list