[Android] Force updating the sleep timer value when set from remote access

Nicolas Pomepuy git at videolan.org
Mon Sep 9 15:14:15 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep  9 15:01:14 2024 +0200| [2d8415e419234f55b57ef30e9111b71937283685] | committer: Duncan McNamara

Force updating the sleep timer value when set from remote access

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

 .../vlc/webserver/websockets/RemoteAccessWebSockets.kt    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
index 1043632e4c..e108c20736 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/websockets/RemoteAccessWebSockets.kt
@@ -193,16 +193,31 @@ object RemoteAccessWebSockets {
                                     service?.setSleepTimer(sleepTime)
                                 }
                                 if (playbackControlAllowedOrSend(settings)) service?.sleepTimerInterval = sleepTimerEnd
+                                AppScope.launch {
+                                    RemoteAccessServer.getInstance(context).generateNowPlaying()?.let { nowPlaying ->
+                                        AppScope.launch { sendToAll(nowPlaying) }
+                                    }
+                                }
                             }
                         }
                         "sleep-timer-wait" -> {
                             incomingMessage.stringValue?.let { waitForMediaEnd ->
                                 service?.waitForMediaEnd = waitForMediaEnd == "true"
+                                AppScope.launch {
+                                    RemoteAccessServer.getInstance(context).generateNowPlaying()?.let { nowPlaying ->
+                                        AppScope.launch { sendToAll(nowPlaying) }
+                                    }
+                                }
                             }
                         }
                         "sleep-timer-reset" -> {
                             incomingMessage.stringValue?.let { resetOnInteraction ->
                                 service?.resetOnInteraction = resetOnInteraction == "true"
+                                AppScope.launch {
+                                    RemoteAccessServer.getInstance(context).generateNowPlaying()?.let { nowPlaying ->
+                                        AppScope.launch { sendToAll(nowPlaying) }
+                                    }
+                                }
                             }
                         }
                         "add-bookmark" -> {



More information about the Android mailing list