Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTT Press to Talk - Need to take action while a key is pressed #3

Closed
e4rthdog opened this issue Jun 3, 2020 · 1 comment
Closed

Comments

@e4rthdog
Copy link

e4rthdog commented Jun 3, 2020

I need to implement a PTT Press To Talk , function in my app..

That is i need to do something while the key is pressed. Is there any way to do that with this library?

Thank you!

@Willy-Kimura
Copy link
Owner

Great question and use-case.

Yes, that is very possible considering HotkeyListener supports the global KeyPressed event of any registered keys. You can allow a PTT function to be invoked whenever the end-user presses and holds any registered Hotkey that can be run until they release the Hotkey.

Here's an example:

private void HotkeyListener_HotkeyPressed(object sender, HotkeyEventArgs e)
{
    if (e.Hotkey == pttHotkey)
    {
        // Run PTT function until hotkey is released.
        Talk();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants