I have a trouble in changing Video item sources. In a code below I pick randomly a mov file from the folder on a mouse click. After 2 - 7 (max) times it always hangs (on changing). All movs are rather small (700 kb - 7 mb), H.264, Mac OS (El Capitan). Any ideas how to fix it? Or any workaround. Maybe it works on other systems, I can't test it..
Qt Code:
  1. import QtQuick 2.4
  2. import QtMultimedia 5.4
  3. import Qt.labs.folderlistmodel 2.1
  4.  
  5.  
  6. Item {
  7. id:container
  8. property bool change_video: false
  9. width: 320
  10. height: 240
  11.  
  12. FolderListModel {
  13. id: folderModel
  14. folder: "file:///Users/michaellevin/Dropbox/Movie/Xcanvas/XXX/animation/"
  15. nameFilters: ["*.mov"]
  16. }
  17.  
  18. Video
  19. {
  20. id: vvv
  21. width: container.width
  22. height: container.height
  23. //autoLoad: true
  24. autoPlay: true
  25. anchors.fill: parent
  26. anchors.margins: 0
  27. onStopped: play()
  28. }
  29.  
  30. MouseArea {
  31. id: xxx
  32. anchors.fill: parent
  33. onClicked: {
  34. print(123)
  35. var index = Math.floor(Math.random()*(folderModel.count))
  36. print(index)
  37. //vvv.stop()
  38. vvv.source = folderModel.get(index, "fileURL")
  39. //vvv.play()
  40. }
  41. }
  42.  
  43. Timer {
  44. id: start; interval: 10; running: true; repeat: false;
  45. onTriggered: vvv.source = folderModel.get(2, "fileURL")
  46. }
  47. }
To copy to clipboard, switch view to plain text mode