forked from ruedigergad/SkippingStones
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudioplayer_dbus.patch
executable file
·115 lines (113 loc) · 2.73 KB
/
audioplayer_dbus.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
--- AudioPlayer.qml.orig 2014-05-02 14:31:02.344458705 +0300
+++ AudioPlayer.qml 2014-05-02 19:10:45.814402202 +0300
@@ -5,6 +5,7 @@ import Sailfish.Silica 1.0
import Sailfish.Silica.theme 1.0
import Sailfish.Media 1.0
import com.jolla.mediaplayer 1.0
+import org.nemomobile.dbus 1.0
import org.nemomobile.policy 1.0
DockedPanel {
@@ -136,6 +137,7 @@ DockedPanel {
} else {
audio.play()
}
+ mediaPlayerNotification.call("nowPlaying", [currentItem.title, currentItem.album, currentItem.author])
showControls()
}
@@ -440,4 +442,96 @@ DockedPanel {
}
}
}
+
+ DBusAdaptor {
+ id: mediaPlayerRemoteControl
+
+ property bool isPaused: false
+
+ service: "com.jolla.mediaplayer.remotecontrol"
+ iface: "com.jolla.mediaplayer.remotecontrol.Interface"
+ path: "/com/jolla/mediaplayer/remotecontrol"
+
+ signal executeCommand(string command)
+
+ onExecuteCommand: {
+ console.log("Trying to execute command: " + command)
+ switch (command) {
+ case "next":
+ songList.playNext()
+ break
+ case "toggle_pause":
+ if (isPaused) {
+ player._play()
+ isPaused = false
+ } else {
+ player.pause()
+ isPaused = true
+ }
+ break
+ case "prev":
+ songList.playPrevious()
+ break
+ }
+ }
+ }
+
+ DBusAdaptor {
+ id: mediaPlayerRemoteControlMPRIS
+ // patrial implementation of the MPRIS specification : http://specifications.freedesktop.org/mpris-spec/latest/
+
+ service: "org.mpris.MediaPlayer2.jolla_mediaplayer"
+ iface: "org.mpris.MediaPlayer2.Player.Interface"
+ path: "/org/mpris/MediaPlayer2"
+
+ property bool testret: true
+
+ function rcNext() {
+ songList.playNext();
+ return(testret);
+ }
+
+ function rcPrevious(){
+ songList.playPrevious();
+ return(testret);
+ }
+
+ function rcPause() {
+ player.pause()
+ return(testret);
+ }
+
+ function rcPlay() {
+ player._play();
+ return(testret);
+ }
+
+ function rcPlayPause() {
+ if (audio.state == Audio.Playing) {
+ player.pause()
+ } else {
+ player._play()
+ }
+ return(testret);
+ }
+
+ function rcStop() {
+ audio.stop()
+ return(testret);
+ }
+
+
+ }
+
+
+
+
+ DBusInterface {
+ id: mediaPlayerNotification
+
+ destination: "com.jolla.mediaplayer.notification"
+ iface: "com.jolla.mediaplayer.notification.Interface"
+ path: "/com/jolla/mediaplayer/notification"
+ }
+
}