homebridge-samsungtv-control2 icon indicating copy to clipboard operation
homebridge-samsungtv-control2 copied to clipboard

Remote buttons - Play/Pause and Back not working

Open TheEngineerGuy opened this issue 3 years ago • 9 comments

Not sure if this is already known and something you might be working on, but thought I should mention it in case it is not known.

I think overall the remote works terrifically well, and quite responsive. The only short coming I wanted to bring to your attention is Play/Pause and Back button not working.

TheEngineerGuy avatar Jul 31 '20 18:07 TheEngineerGuy

Thanks for the feedback. The problem with the play/pause button is, that there is not a single key for that but only the two separate keys play and pause. I already thought about an internal state logic that assumes playing initially and then toggles between these states but the logic would fail when the real remote play / pause buttons would be pressed.

The problem with the back button actually is something I didn't knew since it works for my devices. The back button is currently mapped to the return key but this might not be the optimal key for all models. I might add an option to customize each remote button.

mmende avatar Jul 31 '20 18:07 mmende

Thanks for a prompt response Martin. I noticed the same thing. I think your logic would work, because button will only fail the first time, once it starts alternating between play and pause it will sync itself. We can possibly simplify it as well, by just alternating between play and pause with each key press. That should give us what we need.

Maybe I add another option. What I see, is that my play button on TV remote is able to both play and pause. Maybe we can try just mapping play to play/pause button, and see if that has any success.

And yes, back mapping to return doesn't work, as we need to map exit to back. But when I went through the key list, I didn't notice the exit key published by Samsung. Maybe they are calling it something else?

TheEngineerGuy avatar Jul 31 '20 18:07 TheEngineerGuy

I tested the thing with pressing the play button multiple times to toggle play / pause and it worked when I e.g. controlled an apple tv over hdmi cec but not when I played something directly from a NAS for example. Therefore the switching approach might be the saver one. I also didn't find any key that sounds like the exit key we are looking for unfortunately.

mmende avatar Aug 01 '20 13:08 mmende

You are right. I haven't used the internal apps in such a long time, I totally forgot about them. All good, switching approach sounds good then. Let me know when you are able to implement and I can test it out.

I will go through the list again to see if there is something else we can use instead of exit.

TheEngineerGuy avatar Aug 01 '20 14:08 TheEngineerGuy

Sounds good... I'm working on it and let you know when it's ready to test.

mmende avatar Aug 01 '20 16:08 mmende

Hi Martin, not sure if you got a chance to look into this one. As for the logic I was thinking about keeping it simple.

I know that implementing this simple logic may not be as easy, but I thought I should throw it over to get what you think.

if flag==0 or flag==NULL
{
 sendKeyPress 'Pause'
 flag=1
}

if  flag==1
{
 sendKeyPress 'Play'
 flag=0
}

TheEngineerGuy avatar Aug 06 '20 16:08 TheEngineerGuy

Not yet. But implementation will be pretty much as you suggested. I will just add some more logic that resets the flag when the tv is detected as being turned off.

mmende avatar Aug 07 '20 11:08 mmende

Makes sense. Reset it to '0' when TV is detected as off, or turned off.

TheEngineerGuy avatar Aug 09 '20 19:08 TheEngineerGuy

Hey @mmende any luck on the play/pause implementation?

I found something that could help us with the back button. So even though it is not widely published, KEY_EXIT does exist. Can you try mapping it to the back button, and see if it works?

EDIT: ref: https://www.dummies.com/web-design-development/mobile-apps/handling-remote-control-events-in-samsung-smarttv-application-development/

TheEngineerGuy avatar Oct 20 '20 03:10 TheEngineerGuy