minor changes to playback interface
This commit is contained in:
parent
6d24095c5c
commit
69e636e446
3 changed files with 22 additions and 20 deletions
|
|
@ -5,6 +5,8 @@ import android.net.Uri;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.dkanada.gramophone.App;
|
||||
import com.dkanada.gramophone.R;
|
||||
import com.dkanada.gramophone.model.Song;
|
||||
|
|
@ -60,9 +62,9 @@ public class MultiPlayer implements Playback {
|
|||
private boolean requestPlay = false;
|
||||
private int requestProgress = 0;
|
||||
|
||||
private ExoPlayer.EventListener eventListener = new ExoPlayer.EventListener() {
|
||||
private final ExoPlayer.EventListener eventListener = new ExoPlayer.EventListener() {
|
||||
@Override
|
||||
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
|
||||
public void onTracksChanged(@NonNull TrackGroupArray trackGroups, @NonNull TrackSelectionArray trackSelections) {
|
||||
Log.i(TAG, "onTracksChanged");
|
||||
}
|
||||
|
||||
|
|
@ -226,6 +228,11 @@ public class MultiPlayer implements Playback {
|
|||
return isReady;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlaying() {
|
||||
return isReady && isPlaying;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (!isReady) {
|
||||
|
|
@ -251,11 +258,6 @@ public class MultiPlayer implements Playback {
|
|||
isReady = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlaying() {
|
||||
return isReady && isPlaying;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgress() {
|
||||
if (!isReady) return -1;
|
||||
|
|
@ -269,13 +271,13 @@ public class MultiPlayer implements Playback {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setProgress(int position) {
|
||||
public void setProgress(int progress) {
|
||||
if (!isReady) {
|
||||
requestProgress = position;
|
||||
requestProgress = progress;
|
||||
return;
|
||||
}
|
||||
|
||||
exoPlayer.seekTo(position);
|
||||
exoPlayer.seekTo(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -9,21 +9,21 @@ public interface Playback {
|
|||
|
||||
void setCallbacks(PlaybackCallbacks callbacks);
|
||||
|
||||
boolean isReady();
|
||||
|
||||
boolean isPlaying();
|
||||
|
||||
void start();
|
||||
|
||||
void pause();
|
||||
|
||||
void stop();
|
||||
|
||||
boolean isReady();
|
||||
|
||||
boolean isPlaying();
|
||||
|
||||
int getProgress();
|
||||
|
||||
int getDuration();
|
||||
|
||||
void setProgress(int position);
|
||||
void setProgress(int progress);
|
||||
|
||||
void setVolume(int volume);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue