use of com.spotify.sdk.android.player.PlayerStateCallback in project wire-android by wireapp.
the class SpotifyMediaPlayer method onLoggedIn.
@Override
public void onLoggedIn() {
if (mediaPlayerState == MediaPlayerState.Paused) {
mediaPlayer.getPlayerState(new PlayerStateCallback() {
@Override
public void onPlayerState(PlayerState playerState) {
if (dataSource.toString().equals(playerState.trackUri)) {
mediaPlayer.resume();
} else {
reset();
onLoggedIn();
}
}
});
} else {
if (listener != null && !mediaPlayerState.isStartAllowed()) {
setState(MediaPlayerState.Prepared);
listener.onPrepared();
} else {
mediaPlayer.play(PlayConfig.createFor(dataSource.toString()).withInitialPosition(currentPosition));
}
}
}
Aggregations