From 5328e63e2c44765e8652a8a19a4844199817a38e Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Wed, 8 May 2024 20:25:59 +0200 Subject: [PATCH] Update outdated PlaybackState enums in QML With the refractor in f91e9f8, an abstraction over QtMultiMedia was implemented. New enums for the PlaybackState were created, to not make the application depend on QtMultiMedia. However, not all code was updated to make proper use of these new enums. This in turn caused the screen turned off while playing a video and the HUD not showing when the video started buffering. This commit fixes that. Closes #51 --- sailfish/qml/components/videoplayer/VideoHud.qml | 11 +++-------- sailfish/qml/harbour-sailfin.qml | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/sailfish/qml/components/videoplayer/VideoHud.qml b/sailfish/qml/components/videoplayer/VideoHud.qml index 79c1c84..d21260b 100644 --- a/sailfish/qml/components/videoplayer/VideoHud.qml +++ b/sailfish/qml/components/videoplayer/VideoHud.qml @@ -152,15 +152,10 @@ Item { Connections { target: manager onMediaStatusChanged: { - console.log("New mediaPlayer status: " + manager.mediaStatus) - switch(manager.mediaStatus) { - case J.MediaStatus.Loaded: - case J.MediaStatus.Buffering: - show(false) - break; - case J.MediaStatus.Buffered: + if (manager.mediaStatus == J.MediaStatus.Loaded || manager.mediaStatus == J.MediaStatus.Buffered) { hide(false) - break; + } else if (manager.mediaStatus == J.MediaStatus.Buffering || manager.mediaStatus == J.MediaStatus.Stalled) { + show(false) } } } diff --git a/sailfish/qml/harbour-sailfin.qml b/sailfish/qml/harbour-sailfin.qml index 565230a..7651dcf 100644 --- a/sailfish/qml/harbour-sailfin.qml +++ b/sailfish/qml/harbour-sailfin.qml @@ -131,11 +131,11 @@ ApplicationWindow { // Keep the sytem alive while playing media KeepAlive { - enabled: playbackManager.playbackState === MediaPlayer.PlayingState + enabled: playbackManager.playbackState == PlayerState.Playing } DisplayBlanking { - preventBlanking: playbackManager.playbackState === MediaPlayer.PlayingState + preventBlanking: playbackManager.playbackState == PlayerState.Playing && playbackManager.hasVideo && playbackManager.controllingSessionLocal // Must be controlling a local session }