mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-30 08:00: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
|
@Override
|
||||||
public int getCurrentPosition() {
|
public int getCurrentPosition() {
|
||||||
return (int) mControlListener.getCurrentPosition();
|
if(mControlListener != null){
|
||||||
|
return (int) mControlListener.getCurrentPosition();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCurrentPositionLong(){
|
public long getCurrentPositionLong(){
|
||||||
return mControlListener.getCurrentPosition();
|
if(mControlListener != null){
|
||||||
|
return mControlListener.getCurrentPosition();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mediaIsStream() {
|
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
|
@Override
|
||||||
public long getBufferedPosition() {
|
public long getBufferedPosition() {
|
||||||
if(player != null){
|
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
|
@Override
|
||||||
public void nextAudioStream() {
|
public void nextAudioStream() {
|
||||||
// TODO cycle through audio streams
|
// TODO cycle through audio streams
|
||||||
|
|
|
@ -107,10 +107,10 @@ public class OverlayFragment extends PlaybackFragment{
|
||||||
void skipBackward(int sec);
|
void skipBackward(int sec);
|
||||||
void seekTo(long sec);
|
void seekTo(long sec);
|
||||||
boolean isMediaPlaying();
|
boolean isMediaPlaying();
|
||||||
|
long getLength();
|
||||||
long getCurrentPosition();
|
long getCurrentPosition();
|
||||||
void releasePlayer();
|
|
||||||
long getPosition();
|
|
||||||
long getBufferedPosition();
|
long getBufferedPosition();
|
||||||
|
void releasePlayer();
|
||||||
void mute(boolean state);
|
void mute(boolean state);
|
||||||
void nextAudioStream();
|
void nextAudioStream();
|
||||||
}
|
}
|
||||||
|
@ -281,14 +281,14 @@ public class OverlayFragment extends PlaybackFragment{
|
||||||
if(mSelectedEvent != null){
|
if(mSelectedEvent != null){
|
||||||
if (mPlaybackProgress != null) {
|
if (mPlaybackProgress != null) {
|
||||||
if ((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
if ((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
||||||
mPlaybackProgress.setProgress(mCallback.getPosition());
|
mPlaybackProgress.setProgress(mCallback.getCurrentPosition());
|
||||||
mPlaybackProgress.save();
|
mPlaybackProgress.save();
|
||||||
} else {
|
} else {
|
||||||
mPlaybackProgress.delete();
|
mPlaybackProgress.delete();
|
||||||
}
|
}
|
||||||
} else if((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
} else if((mSelectedEvent.getLength() - mCallback.getCurrentPosition() / 1000) > MAX_REMAINING) {
|
||||||
mPlaybackProgress = new PlaybackProgress(mSelectedEvent.getGuid(),
|
mPlaybackProgress = new PlaybackProgress(mSelectedEvent.getGuid(),
|
||||||
mCallback.getPosition(), mSelectedRecording.getApiID());
|
mCallback.getCurrentPosition(), mSelectedRecording.getApiID());
|
||||||
mPlaybackProgress.save();
|
mPlaybackProgress.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue