mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-26 22:20:24 +00:00
change handling of playback progress
This commit is contained in:
parent
a8a0be2c06
commit
dc56aa9a30
3 changed files with 20 additions and 14 deletions
|
@ -285,11 +285,17 @@ public class PlaybackHelper extends PlaybackControlGlue {
|
|||
|
||||
@Override
|
||||
public int getCurrentPosition() {
|
||||
return (int) mControlListener.getCurrentPosition();
|
||||
if(mControlListener != null){
|
||||
return (int) mControlListener.getCurrentPosition();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getCurrentPositionLong(){
|
||||
return mControlListener.getCurrentPosition();
|
||||
if(mControlListener != null){
|
||||
return mControlListener.getCurrentPosition();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean mediaIsStream() {
|
||||
|
|
|
@ -157,14 +157,6 @@ public class PlayerActivity extends AbstractServiceConnectedAcitivty
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPosition() {
|
||||
if(player != null){
|
||||
return player.getCurrentPosition();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBufferedPosition() {
|
||||
if(player != null){
|
||||
|
@ -180,6 +172,14 @@ public class PlayerActivity extends AbstractServiceConnectedAcitivty
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength(){
|
||||
if(player != null){
|
||||
return player.getDuration();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nextAudioStream() {
|
||||
// TODO cycle through audio streams
|
||||
|
|
|
@ -107,10 +107,10 @@ public class OverlayFragment extends PlaybackFragment{
|
|||
void skipBackward(int sec);
|
||||
void seekTo(long sec);
|
||||
boolean isMediaPlaying();
|
||||
long getLength();
|
||||
long getCurrentPosition();
|
||||
void releasePlayer();
|
||||
long getPosition();
|
||||
long getBufferedPosition();
|
||||
void releasePlayer();
|
||||
void mute(boolean state);
|
||||
void nextAudioStream();
|
||||
}
|
||||
|
@ -281,14 +281,14 @@ public class OverlayFragment extends PlaybackFragment{
|
|||
if(mSelectedEvent != null){
|
||||
if (mPlaybackProgress != null) {
|
||||
if ((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
||||
mPlaybackProgress.setProgress(mCallback.getPosition());
|
||||
mPlaybackProgress.setProgress(mCallback.getCurrentPosition());
|
||||
mPlaybackProgress.save();
|
||||
} else {
|
||||
mPlaybackProgress.delete();
|
||||
}
|
||||
} else if((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
||||
mPlaybackProgress = new PlaybackProgress(mSelectedEvent.getGuid(),
|
||||
mCallback.getPosition(), mSelectedRecording.getApiID());
|
||||
mCallback.getCurrentPosition(), mSelectedRecording.getApiID());
|
||||
mPlaybackProgress.save();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue