Enable Fast Forward and Rewind keys on Google TV remotes.

This enables the Fast Forward and Rewind keys on the google tv remote.
If pressed it will jump ahead by 10 seconds or go back by 10 seconds.
This commit is contained in:
David Carver 2013-07-02 20:01:22 -04:00
parent 62961d6594
commit 743587ee0c
1 changed files with 22 additions and 0 deletions

View File

@ -432,7 +432,29 @@ public class PlaybackService extends Service {
pause(true, true);
}
break;
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
int currentPos = getCurrentPositionSafe();
int duration = getDurationSafe();
if (currentPos != INVALID_TIME && duration != INVALID_TIME) {
if (currentPos < duration) {
seek(currentPos + 10000);
}
}
break;
}
case KeyEvent.KEYCODE_MEDIA_REWIND: {
int currentPos = getCurrentPositionSafe();
int duration = getDurationSafe();
if (currentPos != INVALID_TIME && duration != INVALID_TIME) {
if (currentPos > 10000) {
seek(currentPos - 10000);
}
}
break;
}
}
}
/**