X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=app%2FMediaPlayer.qml;h=95bc22bc32bab0ec1a12326977e55cc92afacb16;hb=refs%2Fchanges%2F46%2F27646%2F1;hp=177fe3634a271d6d4195f22ac28e612449aeb77b;hpb=d53efa6bca224f2c6bec8e7b14b1dff7f12a2d03;p=apps%2Fmediaplayer.git 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