[Android] Streams: Fix crash when playing audio

Geoffrey Métais git at videolan.org
Mon Mar 30 11:25:52 CEST 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 30 09:27:43 2020 +0200| [53fe49ab39edbe1240fcb443f5e8ee686ffd84b9] | committer: Geoffrey Métais

Streams: Fix crash when playing audio

Fix #1249

> https://code.videolan.org/videolan/vlc-android/commit/53fe49ab39edbe1240fcb443f5e8ee686ffd84b9
---

 .../src/org/videolan/vlc/viewmodels/StreamsModel.kt            | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
index 3b5221494..e076097c7 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/StreamsModel.kt
@@ -44,6 +44,10 @@ class StreamsModel(context: Context, coroutineContextProvider: CoroutineContextP
     val observableSearchText = ObservableField<String>()
     var service: PlaybackService? = null
 
+    private val serviceCb = object : PlaybackService.Callback by EmptyPBSCallback {
+        override fun update() = refresh()
+    }
+
     init {
         if (medialibrary.isStarted) refresh()
         PlaybackService.serviceFlow.onEach { onServiceChanged(it) }.launchIn(viewModelScope)
@@ -81,12 +85,6 @@ class StreamsModel(context: Context, coroutineContextProvider: CoroutineContextP
         }
     }
 
-    private val serviceCb = object : PlaybackService.Callback by EmptyPBSCallback {
-        override fun update() {
-            refresh()
-        }
-    }
-
     class Factory(private val context: Context) : ViewModelProvider.Factory {
         override fun <T : ViewModel> create(modelClass: Class<T>): T {
             @Suppress("UNCHECKED_CAST")



More information about the Android mailing list