Skip to content

Commit

Permalink
Update outdated PlaybackState enums in QML
Browse files Browse the repository at this point in the history
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
  • Loading branch information
HenkKalkwater committed May 8, 2024
1 parent 19efba4 commit 5328e63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 3 additions & 8 deletions sailfish/qml/components/videoplayer/VideoHud.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions sailfish/qml/harbour-sailfin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5328e63

Please sign in to comment.