Pause radio on play
[apps/mediaplayer.git] / app / MediaPlayer.qml
index 9562f14..c859509 100644 (file)
@@ -37,7 +37,6 @@ ApplicationWindow {
         property int duration: 0
         property int position: 0
 
-        property string cover_art: ""
         property string status: "stopped"
 
         function time2str(value) {
@@ -60,10 +59,6 @@ ApplicationWindow {
             }
 
             if (track) {
-                if ('image' in track) {
-                     player.cover_art = track.image
-                }
-
                 player.title = track.title
                 player.album = track.album
                 player.artist = track.artist
@@ -105,13 +100,12 @@ ApplicationWindow {
             Layout.preferredHeight: 1080
             clip: true
             Image {
-                id: albumart
                 anchors.left: parent.left
                 anchors.right: parent.right
                 anchors.bottom: parent.bottom
                 height: sourceSize.height * width / sourceSize.width
                 fillMode: Image.PreserveAspectCrop
-                source: player.cover_art ? player.cover_art : ''
+                source: AlbumArt
                 visible: player.av_connected === false
             }
 
@@ -201,6 +195,7 @@ ApplicationWindow {
                             id: previous
                             offImage: './images/AGL_MediaPlayer_BackArrow.svg'
                             onClicked: {
+                                radio.stop()
                                 mediaplayer.previous()
                             }
                         }
@@ -222,7 +217,10 @@ ApplicationWindow {
                                     PropertyChanges {
                                         target: play
                                         offImage: './images/AGL_MediaPlayer_Player_Play.svg'
-                                        onClicked: mediaplayer.play()
+                                        onClicked: {
+                                            radio.stop()
+                                            mediaplayer.play()
+                                        }
                                     }
                                 }
                             ]
@@ -231,6 +229,7 @@ ApplicationWindow {
                             id: forward
                             offImage: './images/AGL_MediaPlayer_ForwardArrow.svg'
                             onClicked: {
+                                radio.stop()
                                 mediaplayer.next()
                             }
                         }
@@ -300,6 +299,7 @@ ApplicationWindow {
                         //}
                     }
                     onClicked: {
+                        radio.stop()
                         mediaplayer.picktrack(playlistview.model[index].index)
                     }
                 }