X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2FMediaPlayer.qml;h=95bc22bc32bab0ec1a12326977e55cc92afacb16;hb=refs%2Fchanges%2F46%2F27646%2F1;hp=74fcf2ee8689fface40c4f45b3ed112cb392f242;hpb=8a7865f1e9152b5098e1f1183310e90a10a58de1;p=apps%2Fmediaplayer.git diff --git a/app/MediaPlayer.qml b/app/MediaPlayer.qml index 74fcf2e..95bc22b 100644 --- a/app/MediaPlayer.qml +++ b/app/MediaPlayer.qml @@ -46,6 +46,13 @@ ApplicationWindow { } } + Component.onCompleted : { + // Let the mediaplayer backend know we're ready for metadata events + mediaplayer.start() + + VehicleSignals.connect() + } + Connections { target: mediaplayer @@ -81,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 @@ -258,7 +292,7 @@ ApplicationWindow { Item { Layout.fillWidth: true Layout.fillHeight: true - Layout.preferredHeight: container.height / 2 + Layout.preferredHeight: 407 ListView { anchors.fill: parent