Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Fast Forward and Rewind during Timeshifting and playing back of Recorded Shows #239

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions app/src/main/java/ie/macinnes/tvheadend/player/TvheadendPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,46 +235,46 @@ public void seek(long timeMs) {
public void setPlaybackParams(PlaybackParams params) {
float rawSpeed = params.getSpeed();
int speed = (int) rawSpeed;

int translatedSpeed;

switch(speed) {
case 0:
case 1:
translatedSpeed = 100;
break;
case -2:
translatedSpeed = -200;
break;
case -4:
case -3:
translatedSpeed = -300;
break;
case -12:
case -4:
translatedSpeed = -400;
break;
case -48:
case -5:
translatedSpeed = -500;
break;
case 2:
translatedSpeed = 200;
break;
case 4:
case 8:
translatedSpeed = 300;
break;
case 12:
case 32:
translatedSpeed = 400;
break;
case 48:
case 128:
translatedSpeed = 500;
break;
default:
Log.d(TAG, "Unknown speed??? " + rawSpeed);
return;
return;
}

Log.d(TAG, "Speed: " + params.getSpeed() + " / " + translatedSpeed);

if (mDataSource != null) {
mDataSource.setSpeed(translatedSpeed);
mExoPlayer.setPlaybackParameters(new PlaybackParameters(translatedSpeed, 0));
mExoPlayer.setPlaybackParameters(new PlaybackParameters(speed, 1));
}
}

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/ie/macinnes/tvheadend/tvinput/HtspSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void onSetStreamVolume(float volume) {
@Override
public View onCreateOverlayView() {
Log.d(TAG, "Session onCreateOverlayView (" + mSessionNumber + ")");

return mTvheadendPlayer.getOverlayView(
mCaptioningManager.getUserStyle(), mCaptioningManager.getFontScale());
}
Expand Down Expand Up @@ -203,8 +204,13 @@ public void onTimeShiftSeekTo(long timeMs) {
@Override
public void onTimeShiftSetPlaybackParams(PlaybackParams params) {
Log.d(TAG, "onTimeShiftSetPlaybackParams: " + params);

Toast.makeText(mContext, "Unsupported", Toast.LENGTH_SHORT).show();
if (params.getSpeed() == 1) {
mTvheadendPlayer.setVolume(1.0f);
}
else {
mTvheadendPlayer.setVolume(0f);
}
mTvheadendPlayer.setPlaybackParams(params);
}

@RequiresApi(api = Build.VERSION_CODES.M)
Expand Down