videos played are now random

This commit is contained in:
eximus
2017-04-01 11:11:58 +01:00
parent dec151bf02
commit 529dafa55a
2 changed files with 22 additions and 4 deletions

View File

@@ -56,9 +56,14 @@ Rectangle {
MediaPlayer {
id: mediaplayer
autoPlay: true
loops: MediaPlayer.Infinite
source: config.background
muted: true
playlist: Playlist {
id: playlist
playbackMode: Playlist.Random
onLoaded: {
mediaplayer.play()
}
}
}
VideoOutput {
@@ -67,6 +72,14 @@ Rectangle {
source: mediaplayer
}
MouseArea {
anchors.fill: parent;
onPressed: {
playlist.shuffle();
playlist.next();
}
}
// Clock and Login Area
Rectangle {
id: rectangle
@@ -331,13 +344,18 @@ Rectangle {
}
}
// Set Focus
Component.onCompleted: {
// Set Focus
if (username_input_box.text == "")
username_input_box.focus = true
else
password_input_box.focus = true
// load and randomize playlist
playlist.load(Qt.resolvedUrl(config.background), 'm3u')
for (var k = 0; k < Math.ceil(Math.random() * 10) ; k++) {
playlist.shuffle()
}
}
}