When using a remote to select the previous track, two button presses are required, the first to restart the playing track and then a second (within a second or so) to actually move to the previous track. The same as using the U.I.
If, however, the ‘previous’ button is pressed too many times in quick succession, the remote ceases to have any effect - a wait of a minute or so is needed before it works again. The U.I. still works during this time.
Has anyone had this problem?
Has anyone found a solution?
Do I simply have to train my remote users to be more patient?
Added question…
Has anyone a technique to make a single press of the ‘previous’ button repeat the instruction twice, thus actually selecting the previous track.
I have tried adding ‘repeat = 2’ in lircrc but to no avail.
That would just be confusing for most users, it works with 2 successive presses on almost every mediaplayer i know, and that’s how I expect it to work when i try new one.
It’s a proplem with the remote or the receiving software if it hangs when buttons are pressed too fast and should be fixed in there.
I don’t believe the Volumio API is doing any debouncing, so that could be the issue.
One could test with a simple bash loop and curl to the API point while looking at the state…
Most streaming (well Spotify) API’s distinguish what “Prev” means depending on the current track position. If it’s more than a certain threshold, it goes to the beginning of the track, else it skips to the previous track .
…in lircrc at least stops the remote from hanging when presses are too rapid.
It just means that twice as many key presses are need to work back up the queue than were needed to work down it.
Not a great solution for the radio stations playlist, still hanging.
Not perfect…yet.
Should anyone else want their remote control to skip to the previous track rather than to the beginning of the current track, here’s how I’ve done it.
//truePrevious
var io = require('socket.io-client');
var socket = io.connect('http://localhost:3000');
var position = 0;
socket.emit('getState', '');
socket.on('pushState', function (data) {
if (data.position >= 1)
{
position = (data.position);
position --;
socket.on('pushState', function () {
});
socket.emit("play",{"value":position});
}
socket.disconnect();
});
Place the above script (I called it ‘truePrevious’) into a folder of your choice (e.g. /home/volumio)
The folder will also need node_modules installed - so from within the folder, issue the command;
npm install socket.io-client@^1.7.4
Now edit your lircrc file and assign a button. For me it was;
prog = irexec
button = Left
config = node/home/volumio/truePrevious
end
Now I can skip backwards (admittedly not quite as quickly as skipping forwards) without the remote hanging for a minute or two. This also works with a playlist of radio stations. Apart from the slight time delay, I’m quite happy with the result. Anyone with a way to speed things up please feel free to adapt and inform…
Other audio players (such as the one in my car) operate the same way: one press to get back to the beginning of a track and, quickly, another press to get to previous track. Actually, that’s preferable behavior (for me) since I more often want to get back to the beginning of the current track than to get back to the previous track.
I’ve nothing against the way that the players use the previous button. I was more concerned that the remote could be ‘confused’ by too many presses.
I’ve now got the best of both worlds, one button for Volumio previous and another for mine. Happy days!
I can actually confirm that the hanging can be reproduced with websocket API easily as spamming the previous/next command, perhaps the issue should be resolved in common code area for both websocket and ir remote, probably the issue is there also for rest API and any other method of issuing commands.
Does JavaScript provide any kind of Queue data type?(something that is safe to write by multiple producers, and then let volumio be single consumer in first come first serve manner for the commands for example)
Sorry for the late reply. I have got a plugin working, many school boy errors had to be sorted! Now I’ll see what I can do with my sub zero knowledge of git hub. I think it could win the prize for ‘least necessary plugin ever developed’ but if it actually helps anyone then so much the better.
I’ll post the git location when I can.