summaryrefslogtreecommitdiffstats
path: root/app/MediaPlayer.qml
diff options
context:
space:
mode:
Diffstat (limited to 'app/MediaPlayer.qml')
-rw-r--r--app/MediaPlayer.qml29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/MediaPlayer.qml b/app/MediaPlayer.qml
index 177fe36..95bc22b 100644
--- a/app/MediaPlayer.qml
+++ b/app/MediaPlayer.qml
@@ -49,6 +49,8 @@ ApplicationWindow {
Component.onCompleted : {
// Let the mediaplayer backend know we're ready for metadata events
mediaplayer.start()
+
+ VehicleSignals.connect()
}
Connections {
@@ -86,6 +88,33 @@ ApplicationWindow {
}
}
+ Connections {
+ target: VehicleSignals
+
+ onConnected: {
+ VehicleSignals.authorize()
+ }
+
+ onAuthorized: {
+ VehicleSignals.subscribe("Vehicle.Cabin.Infotainment.Media.Action")
+ }
+
+ onSignalNotification: {
+ if (path === "Vehicle.Cabin.Infotainment.Media.Action") {
+ if (value == "SkipForward") {
+ mediaplayer.next()
+ } else if (value == "SkipBackward") {
+ mediaplayer.previous()
+ } else if (value == "NextSource") {
+ if (player.av_connected)
+ mediaplayer.connect()
+ else
+ mediaplayer.disconnect()
+ }
+ }
+ }
+ }
+
Timer {
id: timer
interval: 250