Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michael-riha/b77f77505120aff4528c2995890d33a5 to your computer and use it in GitHub Desktop.
Save michael-riha/b77f77505120aff4528c2995890d33a5 to your computer and use it in GitHub Desktop.
Listen to all dispatched events inside the Activity for Android TV - https://github.com/bitmovin/bitmovin-player-android-samples/
// https://github.com/bitmovin/bitmovin-player-android-samples/blob/5f0719f954e4ce8faee1bb290bed715a7ae1b935/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L116-L130
@Override
public boolean dispatchKeyEvent(KeyEvent event)
{
// This method is called on key down and key up, so avoid being called twice
if (this.bitmovinPlayerView != null && event.getAction() == KeyEvent.ACTION_DOWN)
{
if (this.handleUserInput(event.getKeyCode()))
{
return true;
}
}
// Make sure to return super.dispatchKeyEvent(event) so that any key not handled yet will work as expected
return super.dispatchKeyEvent(event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment