[Android] Prevent updating the widget with video playback at all

Nicolas Pomepuy git at videolan.org
Wed Feb 5 14:42:01 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Feb  5 15:01:16 2025 +0100| [cf90f3ca104e0bb3921cd62143a0557318e5c1e1] | committer: Nicolas Pomepuy

Prevent updating the widget with video playback at all

Except when the video is played as audio / in background

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

 .../src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
index f30009e8a7..567c38c1a4 100644
--- a/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/widget/MiniPlayerAppWidgetProvider.kt
@@ -161,7 +161,7 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
 //        val secondaryBackgroundColor = widgetCacheEntry.widget.getBackgroundColor(context, palette = palette, secondary = true)
 
         val service = PlaybackService.serviceFlow.value
-        val playing = (service?.isPlaying == true && !forPreview) || previewPlaying
+        val playing = (service?.isPlaying == true && !forPreview && !service.isVideoPlaying) || previewPlaying
         val colorChanged = !partial || widgetCacheEntry.foregroundColor != foregroundColor || (widgetCacheEntry.widget.theme == 1 && widgetCacheEntry.playing != playing)
         widgetCacheEntry.foregroundColor = foregroundColor
 
@@ -297,10 +297,10 @@ class MiniPlayerAppWidgetProvider : AppWidgetProvider() {
             views.setImageViewBitmap(R.id.cover, cutBitmapCover(widgetType, previewBitmap!!, widgetCacheEntry))
         } else if (widgetCacheEntry.currentMedia?.artworkMrl != widgetCacheEntry.currentCover || widgetCacheEntry.currentCoverInvalidated) {
             widgetCacheEntry.currentCoverInvalidated = false
-            widgetCacheEntry.currentCover = if (service?.isVideoPlaying == false) widgetCacheEntry.currentMedia?.artworkMrl
+            widgetCacheEntry.currentCover = if (service?.isPlaying == true && !service.isVideoPlaying) widgetCacheEntry.currentMedia?.artworkMrl
                     ?: settings.getString(KEY_CURRENT_AUDIO_RESUME_THUMB, null) else settings.getString(KEY_CURRENT_AUDIO_RESUME_THUMB, null)
             if (!widgetCacheEntry.currentCover.isNullOrEmpty()) {
-                log(appWidgetId, WidgetLogType.INFO, "Bugfix Refresh - Update cover: ${widgetCacheEntry.currentMedia?.artworkMrl} for ${widgetCacheEntry.widget.widgetId}")
+                log(appWidgetId, WidgetLogType.INFO, "Bugfix Refresh - Update cover: ${widgetCacheEntry.currentMedia?.artworkMrl} for ${widgetCacheEntry.widget.widgetId} -> ${widgetCacheEntry.currentCover}")
                 runIO {
                     log(appWidgetId, WidgetLogType.BITMAP_GENERATION, "Generating cover")
                     val cover = AudioUtil.readCoverBitmap(Uri.decode(widgetCacheEntry.currentCover), 320)



More information about the Android mailing list