1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-12-22 22:15:17 +00:00

Prevent device from sleeping while media is playing

I was testing the entire time on net power, so I forgot that the device
goes to sleep after a while.
This commit is contained in:
Chris Josten 2020-09-27 20:51:07 +02:00
parent 9b16d91b3e
commit 6429ee5332

View file

@ -21,7 +21,9 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
import QtMultimedia 5.6
import nl.netsoj.chris.Jellyfin 1.0
import Nemo.Notifications 1.0
import Nemo.KeepAlive 1.2
import "components"
import "pages"
@ -52,11 +54,6 @@ ApplicationWindow {
}
}
MediaPlayer {
id: _mediaPlayer
autoPlay: true
}
initialPage: Component {
MainPage {
Connections {
@ -95,4 +92,19 @@ ApplicationWindow {
publish();
}
}
MediaPlayer {
id: _mediaPlayer
autoPlay: true
}
// Keep the sytem alive while playing media
KeepAlive {
enabled: _mediaPlayer.playbackState == MediaPlayer.PlayingState
}
DisplayBlanking {
preventBlanking: _mediaPlayer.playbackState == MediaPlayer.PlayingState && _mediaPlayer.hasVideo
}
}