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