Add start call to QML
[apps/mediaplayer.git] / app / MediaPlayer.qml
index 85328a9..177fe36 100644 (file)
  * limitations under the License.
  */
 
-import QtQuick 2.6
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 2.0
+import QtQuick 2.11
+import QtQuick.Layouts 1.11
+import QtQuick.Controls 2.4
+import QtQuick.Window 2.13
+
 import AGL.Demo.Controls 1.0
 
 ApplicationWindow {
@@ -44,6 +46,11 @@ ApplicationWindow {
         }
     }
 
+    Component.onCompleted : {
+        // Let the mediaplayer backend know we're ready for metadata events
+        mediaplayer.start()
+    }
+
     Connections {
         target: mediaplayer
 
@@ -59,10 +66,14 @@ ApplicationWindow {
             }
 
             if (track) {
+                if ('image' in track)
+                     return
                 player.title = track.title
                 player.album = track.album
                 player.artist = track.artist
-                player.duration = track.duration
+
+                if ('duration' in track)
+                     player.duration = track.duration
 
                 if ('index' in track) {
                      playlistview.currentIndex = track.index
@@ -88,9 +99,10 @@ ApplicationWindow {
     Item {
         id: container
         anchors.centerIn: parent
-        width: 1080
-        height: 1487
-        scale: screenInfo.scale_factor()
+        width: Window.width
+       height: Window.height
+        //scale: screenInfo.scale_factor()
+        scale: 1
 
     ColumnLayout {
         anchors.fill: parent