property int position: 0
property string cover_art: ""
- property string status: ""
+ property string status: "stopped"
function time2str(value) {
return Qt.formatTime(new Date(value), 'mm:ss')
if (data.Connected == "False")
return
- if (!bluetooth.av_connected && data.AVPConnected == "True")
+ if (!bluetooth.av_connected && data.AVPConnected == "True") {
mediaplayer.pause()
+ player.status = "stopped"
+ }
bluetooth.connected = data.Connected == "True"
bluetooth.av_connected = data.AVPConnected == "True"
}
ImageButton {
id: play
- offImage: './images/AGL_MediaPlayer_Player_Play.svg'
- onClicked: {
- if (bluetooth.av_connected) {
- bluetooth.set_avrcp_controls("Play")
- } else {
- mediaplayer.play()
- }
- }
states: [
State {
- when: player.status == "playing"
+ when: !bluetooth.av_connected && player.status == "playing"
PropertyChanges {
target: play
offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
onClicked: {
- player.status = ""
+ player.status = "stopped"
mediaplayer.pause()
}
}
offImage: './images/AGL_MediaPlayer_Player_Pause.svg'
onClicked: bluetooth.set_avrcp_controls("Pause")
}
+ },
+ State {
+ when: !bluetooth.av_connected && player.status != "playing"
+ PropertyChanges {
+ target: play
+ offImage: './images/AGL_MediaPlayer_Player_Play.svg'
+ onClicked: mediaplayer.play()
+ }
+ },
+ State {
+ when: bluetooth.av_connected && bluetooth.state != "playing"
+ PropertyChanges {
+ target: play
+ offImage: './images/AGL_MediaPlayer_Player_Play.svg'
+ onClicked: bluetooth.set_avrcp_controls("Play")
+ }
}
-
]
}
ImageButton {