Media Player : Volume button long press to change song

I was trying to find it but it seems it’s not supported.
So I’m looking for a solution how to enable switching songs prev/next using the volume keys.
So the workflow would be this:

  • short press would do Vol Up/Down
  • long press if music is playing Vol Up - prev song, Vol Down - next song
    Any ideas are very welcome.
4 Likes

any news regarding this? Or how can I do this on my own? Right now even sdk installation doesn’t work properly. So I’m kind of locked :confused:

This conflicts with the long press of the volup button (which makes volume go up fast). IMO its better to use another key.

Ie. xperias have a camera button. Maybe you can do something with that.

1 Like

@Edz well if that can be done easily with mcetool then I’m fine with it. Would be great to have some docs for that so I can do this.

@ApB for me it doesn’t matter. I don’t use that function anyway so if I’ll be able to remove that it will be great and using another button from the UX point of view is bad because volup/voldown is the best option cause those buttons are next to each other and perform up/down actions. Power is located above the fingerprint sensor so it would be awkward.

It has nothing to do with Media Player since the volume button event is processed by the system.
See the possible solution on TJC:
https://together.jolla.com/question/172537/patch-for-skipping-tracks-with-volume-rocker/
As you may have noticed, it’s my own old post. I’m too damn lazy to make it a proper patch, but the necessary changes to the VolumeControl.qml are still the same. Heck, if you need, I can attach my current VolumeControl.qml that has the necessary changes.

I’m still new in Sailfish but this looks exactly what I need, am I right?
If so, then it’s great.
I just don’t know what you mean by “make it a proper patch” so it’s not a proper patch? If so what’s missing?

Yup, most likely, it’s exactly what you need.
FYI, the patches here are usually applied through patchmanager (there’s already third version in the wild if I’m not mistaken) which has its own decent repo with maintained patches.
Mine is… well, sort of maintained. That is, every system update I introduce the changes into the new VolumeControl.qml, but since I don’t use the patchmanager, there’s no incentive for me to apply for inclusion into its repo.
If you, or anybody else is willing to do that, you’re welcome.
Here’s the patched file (/usr/share/lipstick-jolla-home-qt5/volumecontrol/VolumeControl.qml) for 4.3 (Jolla, if you read this — the technical forum should allow to attach archives and text file, not only pictures and emojis): VolumeControl.qml - Pastebin.com

2 Likes

This is great man,
Now what’s need is that it should be built into the system and available to be enabled from the settings.
Next step is improved encryption but someone already mentioned that it’s on the map
and the last step would be to get some decent lock screen as the pin code and fingerprint is not safe enough.
Wonderful, thank you very much!

@fgsfdsfgsfds I finally uploaded your patch to PatchManager:
https://coderus.openrepos.net/pm2/project/VolumeControlMediaPlayback

1 Like

Is there any patch assigning Pause to some button? That’s what I miss the most. Currently if I want to pause media playback I need to at least go to the lock screen to access the on-screen media buttons, but that’s only if they’re correctly shown, which often isn’t the case with Android apps (for example, with Youtube Vanced very often the buttons are not shown correctly), or else it takes going to the app itself to pause playback, which is extremely cumbersome. I dream of being able to do it with just a button press (and then another press to resume playback).

I don’t know about any but the bigger problem is missing hw buttons for it. Right now X10 for example has only three physical buttons and all of them are already taken.
If you have some idea please share it and maybe someone can drop some light on to it.

Yeah, that’s right. I’ve made a patch that uses long press of Camera button for the flashlight, and there’s not much left to use… But maybe some kind of 'double click" could be also used. Maybe it’d be doable using QTimer… I’ll play with it in some spare time. Or maybe I’ll sacrifice the Power button’s “double click” (which is showing the home screen or the last used app instead of lock screen) for Pause/Play… If it’s at all remapable, of course.

Great! Is it available from patchmanager? I don’t mange to find it.

yes it is, you probably need to enable “Incompatible patches” as in patchmanager there was no 4.4. version to select. I should also mention that I didn’t check if it works from patchmanager as I’m applying it manualy :frowning:

What I do is just unplug and replug headphones.

No, I haven’t uploaded it to anywhere. But it’s very simple.

Create the following folder:

/usr/share/patchmanager/patches/flashlight-button  

and place in it a file called

unified_diff.patch

with the following contents (just copy&paste it to a new text file):

--- a/usr/share/lipstick-jolla-home-qt5/main.qml
+++ b/usr/share/lipstick-jolla-home-qt5/main.qml
@@ -170,10 +170,10 @@
 
         ShutterKeyHandler {
             // for now playing it safe and allowing only if device is properly unlocked
-            enabled: !lipstickSettings.lockscreenVisible
+            enabled: true 
             onPressAndHold: {
                 vibraEffect.play()
-                cameraInterface.call("showViewfinder", "")
+                flashlightInterface.call("toggleFlashlight", undefined)
             }
         }
 
@@ -183,11 +183,11 @@
         }
 
         DBusInterface {
-            id: cameraInterface
+            id: flashlightInterface
 
-            iface: "com.jolla.camera.ui"
-            service: "com.jolla.camera"
-            path: "/"
+            iface: "com.jolla.settings.system.flashlight"
+            service: "com.jolla.settings.system.flashlight"
+            path: "/com/jolla/settings/system/flashlight"
         }
 
         DBusInterface {

Go to Patchmanager, enable this patch, and that’s it.

So… I’ve realized that I actually don’t need the Prev Song button as I very rarely go back. So I left Next song as it was (or, actually, moved it to Volume Up as I’m somehow used to having Next Song under Vol Up button, not Down) and I replaced Prev Song with Play / Pause. It was as easy as replacing

 mprisManager.previous()

with

mprisManager.playPause()

@wetab73 Thank you very very much for this explanation. :heart_eyes:
ATM used to only old school bash scripts (N900), very happy do be able to taste a bit of those qml things.