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 5 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.

Original file line number Diff line number Diff line change
Expand Up @@ -235,46 +235,11 @@ public void seek(long timeMs) {
public void setPlaybackParams(PlaybackParams params) {
float rawSpeed = params.getSpeed();
int speed = (int) rawSpeed;
int translatedSpeed;

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

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

Log.d(TAG, "Speed: " + params.getSpeed());
if (mDataSource != null) {
mDataSource.setSpeed(translatedSpeed);
mExoPlayer.setPlaybackParameters(new PlaybackParameters(translatedSpeed, 0));
mDataSource.setSpeed(speed);
mExoPlayer.setPlaybackParameters(new PlaybackParameters(speed, 1));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this works out?

mDataSource.setSpeed(speed); passes the speed value over to TVheadend, which expects:

speed              u32   required   Specify speed (0=pause, 100=1x fwd, -100=1x backward)

http://tvheadend.org/projects/tvheadend/wiki/Htsp#subscriptionSpeed-Added-in-version-9

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-added the translated speed in ed1dcf9 and 3284969

}
}

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