@T0MR0, Hi I am using your plugin since years now and I am thankful for.
I have since years an issue but learned to live with that, however now I would like to change my hardware setup and therefore it is maybe time to speak about. Maybe you can help me.
System is Raspberry 4 with latest build and plugin
In the “GPIO Buttons” Plugin I have manipulated all standard actions for other commands except one. That is the “Play/Pause” Command. Why?
I am doing so because the Playing/Pause Command in the “RotaryEncoder II” Plugin has a strange behavior when dealing with playing web radio.
When I am executing the button function “play/pause” on e.g., GPIO 4 and want to play web radio the following will happen:
Step No. | Hardware | Command | Action | Result
- | Button GPIO4 | Play/Pause | Play | True
- | Button GPIO4 | Play/Pause | Pause | True
- | Button GPIO4 | Play/Pause | Play | True
- | Button GPIO4 | Play/Pause | Play | False
That means Play, Pause, Play, FAILURE because the radio will not stop anymore with the buttons toggle command. when I set “Play” on short press and “Stop” on long press command it is working!
Assumption:
web radio needs some special support to work properly with the play/pause toggle command
While all other player sources are working with the emit command “pause” the web radio source needs the command “stop” instead.
While investigating a bit I found that in the “GPIO Button” plugin in the “gpio-buttons/index.js” there is a “if/else” request to find out if web radio is used, and if yes, the command is:
//Play / Pause
GPIOButtons.prototype.playPause = function() {
//this.logger.info('GPIO-Buttons: Play/pause button pressed');
socket.emit('getState','');
socket.once('pushState', function (state) {
if(state.status=='play' && state.service=='webradio'){
socket.emit('stop');
} else if(state.status=='play'){
socket.emit('pause');
} else {
socket.emit('play');
}
});
};
Is there a way to write that code in an emit command for your plugin?
As I have no experience with “if/else” commands in emit commands and I do not know if this is supported it seems I need a little bit help from your side. Please can you support me?
Kind Regards
Benjamin
