aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-qml/test/Video.qml
blob: e7d0626d05f7b8c191f3a6371b9edc24e2f40b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import QtQuick 2.0
import QtMultimedia 5.7
import QtQuick.Window 2.2
import Qt.labs.folderlistmodel 2.1

Rectangle {
  //width: Screen.width
  //height: Screen.height
  width: 800
  height: 600
  color: "black"

  FolderListModel {
    id: folderModel 
    folder: "/usr/local/videos"
  } 

  Repeater {
    model: folderModel
    Component {
      Item { 
        Component.onCompleted: { playlist.addItem(fileURL) }
      }
    }
  }

  Playlist {
    id: playlist
    playbackMode: Playlist.Random
    PlaylistItem { source: "/" }
    onError: { console.log("ERROR") }
  }

  MediaPlayer {
    id: player
    autoPlay: true
    playlist: playlist
  }

  VideoOutput {
    id: videoOutput
    source: player
    anchors.fill: parent
  }
  
  Component.onCompleted: {
    playlist.shuffle()
    console.log(playlist.itemCount)
  }
}
bgstack15