I'm working with remote android TV To catch event when use press remote button I use this code:
public boolean dispatchKeyEvent(KeyEvent event) {
Log.d("LOG", "Number repeate count = " + event.getRepeatCount());
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_1:
exoPlayerManager.showControllerView();
if (event.getRepeatCount() > 0) {
if (videoPlayerView.getPlaybackControlView().getPlayer().getPlaybackParameters().speed >= 64) {
((TextView)videoPlayerView.getPlaybackControlView().findViewById(R.id.exo_rate)).setVisibility(View.GONE);
videoPlayerView.getPlaybackControlView().getPlayer().setPlaybackParameters(new PlaybackParameters(1, 1.0f));
} else {
videoPlayerView.getPlaybackControlView().getPlayer().setPlaybackParameters(new PlaybackParameters(2 * videoPlayerView.getPlaybackControlView().getPlayer().getPlaybackParameters().speed, 1.0f));
}
((TextView)videoPlayerView.getPlaybackControlView().findViewById(R.id.exo_rate)).setText(videoPlayerView.getPlaybackControlView().getPlayer().getPlaybackParameters().speed + "X");
}else if (videoPlayerView.getPlaybackControlView() != null) {
return videoPlayerView.getPlaybackControlView().dispatchKeyEvent(event);
}
break;
I see that when I press 1 button on remote, getRepeateCount()
always return 0.
I think if i pressed duplicate it should be greater 0.
What is wrong here ?