Created
January 4, 2019 08:32
-
-
Save michael-riha/78b1ccc91801136027dd77d2510fd55b to your computer and use it in GitHub Desktop.
In the handleUserInput method, we pass the code of the key pushed by D-Pad or gamepad - https://github.com/bitmovin/bitmovin-player-android-samples/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L134-L167 | |
private boolean handleUserInput(int keycode) | |
{ | |
Log.d(TAG, "Keycode " + keycode); | |
switch (keycode) | |
{ | |
case KeyEvent.KEYCODE_DPAD_CENTER: | |
case KeyEvent.KEYCODE_ENTER: | |
case KeyEvent.KEYCODE_NUMPAD_ENTER: | |
case KeyEvent.KEYCODE_SPACE: | |
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: | |
this.togglePlay(); | |
return true; | |
case KeyEvent.KEYCODE_MEDIA_PLAY: | |
this.bitmovinPlayer.play(); | |
return true; | |
case KeyEvent.KEYCODE_MEDIA_PAUSE: | |
this.bitmovinPlayer.pause(); | |
return true; | |
case KeyEvent.KEYCODE_MEDIA_STOP: | |
this.stopPlayback(); | |
return true; | |
case KeyEvent.KEYCODE_DPAD_RIGHT: | |
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: | |
this.seekForward(); | |
break; | |
case KeyEvent.KEYCODE_DPAD_LEFT: | |
case KeyEvent.KEYCODE_MEDIA_REWIND: | |
this.seekBackward(); | |
break; | |
default: | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment