Nvidia Shied - Pause Button

Post your questions and help other users.

Moderator: Martin

Post Reply
boxgr0ve
Posts: 3
Joined: 03 Mar 2018 16:01

Nvidia Shied - Pause Button

Post by boxgr0ve » 04 Mar 2018 09:50

Morning, I've installed Automagic on a Nvidia Shield, slowly getting to grips with automation, worked out how to launch applications from other devices, but what I'm trying to do now is simulate receiving a pause button press?

Any ideas?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Nvidia Shied - Pause Button

Post by Desmanto » 04 Mar 2018 14:58

That is quite troublesome to achieve. what is the thing you want to do using the pause button? Probably it is easier to use other method.

You can try to use sendKey() in action Control UI. Control UI require accessibility to be turned on and sendKey() require Automagic Premium keyboard to be selected as default. (this is quite troublesome, as you have to switch to Automagic keyboard and switch back again after finish). Try to find the key in the list of the sendKey(), by pressing function, search "key", select the sendKey() (either 1st or 2nd one), choose the key. If you don't know exactly the keycode/keyname, and you have root, you can try to install keyevent from playstore. Open the keyevent and press the "pause" button, see what keycode it produce. Use that in the sendKey().
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

boxgr0ve
Posts: 3
Joined: 03 Mar 2018 16:01

Re: Nvidia Shied - Pause Button

Post by boxgr0ve » 04 Mar 2018 16:36

Desmanto wrote:That is quite troublesome to achieve. what is the thing you want to do using the pause button? Probably it is easier to use other method.

You can try to use sendKey() in action Control UI. Control UI require accessibility to be turned on and sendKey() require Automagic Premium keyboard to be selected as default. (this is quite troublesome, as you have to switch to Automagic keyboard and switch back again after finish). Try to find the key in the list of the sendKey(), by pressing function, search "key", select the sendKey() (either 1st or 2nd one), choose the key. If you don't know exactly the keycode/keyname, and you have root, you can try to install keyevent from playstore. Open the keyevent and press the "pause" button, see what keycode it produce. Use that in the sendKey().
Basically I have some automations set up on Homeassistant so when my doorbell rings, it flashes some lights and pauses media. This is working with my set-top-box as I have an IR blaster but my version of the Shield does not have IR. If I'm watching a video through Kodi on the Shield I can pause fine using the web-remote, but I'm struggling to pause manage to pause Netflix.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Nvidia Shied - Pause Button

Post by Desmanto » 04 Mar 2018 17:42

Oh, the main purpose is to pause the video/music. Try use action Control Audio Player, and send to specified app (choose the app). Don't know if it works properly there.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

boxgr0ve
Posts: 3
Joined: 03 Mar 2018 16:01

Re: Nvidia Shied - Pause Button

Post by boxgr0ve » 05 Mar 2018 17:28

Desmanto wrote:Oh, the main purpose is to pause the video/music. Try use action Control Audio Player, and send to specified app (choose the app). Don't know if it works properly there.
Thanks, tried that but nothing happens... I couldn't find Netflix when browsing for applications in '...' so I used com.netflix.ninja (this is the identifier it gave when I selected it previous to launch an application in another flow.

Would I need to put anything in Class name?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Nvidia Shied - Pause Button

Post by Desmanto » 06 Mar 2018 08:44

Just leave the class name blank. It seems netflix doesn't support standard media button, but using keyboard shortcut instead. Try not to check "send to specified app", see if it works. Try the broadcast method too.

If none of these work, then instead of using keyboard shortcut, it is better to use direct control via Control UI. But this mostly works if you play the video in non Fullscreen mode. In the action Control UI, tap the show overlay control; there should be 2 red button on top : INFO and CLOSE (if you don't have this, please enable draw over other app permission for Automagic). Switch back to netflix (leaving the control UI opened). Open a video and show up the media button. Tap the INFO and you will see green border over all available UI elements. Tap the play button, you will see some choice, choose the one start with clickById() if there is. The click action script will be copied. Back to automagic, and you can paste the script. That is the one you need to play/pause the video.

BTW, do you have root? Because everything will be easier then. Full screen playback will hide all the UI element, thus leaving the last resort option; using keyboard shortcut. If you have root, you can simply use execute root command to send the keycode; space/enter to play/pause; F for full screen, etc. If no root, you have to plug your phone to PC first, grant automagic write secure permission thru adb, only need one time granting (until you uninstall Automagic). Then use Set system setting to change the default keyboard to Automagic keyboard, use control UI to send the shortcut key, switch back again to previous keyboard using the same set system setting. Seems more complicated, but the elements actually executed in lightning speed.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply