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 { MediaPlayer {
id: mediaplayer id: mediaplayer
autoPlay: true autoPlay: true
loops: MediaPlayer.Infinite
source: config.background
muted: true muted: true
playlist: Playlist {
id: playlist
playbackMode: Playlist.Random
onLoaded: {
mediaplayer.play()
}
}
} }
VideoOutput { VideoOutput {
@@ -67,6 +72,14 @@ Rectangle {
source: mediaplayer source: mediaplayer
} }
MouseArea {
anchors.fill: parent;
onPressed: {
playlist.shuffle();
playlist.next();
}
}
// Clock and Login Area // Clock and Login Area
Rectangle { Rectangle {
id: rectangle id: rectangle
@@ -331,13 +344,18 @@ Rectangle {
} }
} }
// Set Focus
Component.onCompleted: { Component.onCompleted: {
// Set Focus
if (username_input_box.text == "") if (username_input_box.text == "")
username_input_box.focus = true username_input_box.focus = true
else else
password_input_box.focus = true 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()
}
} }
} }