Control sound with sound keys from Processing app on android

I was looking for a way to use sound controls on android to control remotely (from device) omxplayer running on raspberry pi:

sound-controls

Here is code how to do this easily on processing:


void keyPressed() {
    if (key == CODED && keyCode ==
        android.view.KeyEvent.KEYCODE_VOLUME_DOWN) {
        println ("Volume down");
    }
    if (key == CODED && keyCode ==
        android.view.KeyEvent.KEYCODE_VOLUME_UP) {
        println ("Volume up");
    }
}

Leave a Reply

Your email address will not be published.