Qt 5.6 Looping Video in a Playlist
-
Newbie Qt Multi Media Question.
I have a quick question about a simple application I have written that loads a few video clips and I can play each and advance to the next one. I am using the playlist in QML (Qt 5.6 on Ubuntu, Qt Quick UI app). Here is one problem , I want to loop over the "current" video until I hit "next" and then advance to the next video and if at the last video , start from the first one, so when I set loops: MediaPlayer.Infinite, it does not loop, it plays through the playlist onceHowever, if I use playbackMode: Playlist.Loop in the PlayList block, the looping is over the entire play list not the currently playing one. If I set the playlist to CurrentItemInLoop, it loops over the current video but then I cannot advance to the next video in the list, it just restarts the current video. I am sure this is probably a stupid newbie mistake since this is really a simple app, but is there a trick to this?
Thanks so much
MediaPlayer {
id: player
autoLoad: true
playlist: Playlist {
id: plist
PlaylistItem {source: "/somepath/vido0"}
PlaylistItem {source: "/somepath/vido1"}
PlaylistItem {source: "/somepath/vido2"}
PlaylistItem {source: "/somepath/vido3"}
playbackMode: Playlist.Loop <------ loops over the entire list
}
autoPlay: true
// loops: MediaPlayer.Infinite <----- does not loop at all plays through the list once and it stops} VideoOutput { id: video anchors.fill: parent source: player } Item { focus: true Keys.onPressed: { if (event.key == Qt.Key_N) { plist.next() } if (event.key == Qt.Key_S) { player.pause() } if (event.key == Qt.Key_P) { player.play() } } }