Search in sources :

Example 1 with PlayerStateCallback

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));
        }
    }
}
Also used : MediaPlayerState(com.waz.zclient.controllers.mediaplayer.MediaPlayerState) PlayerState(com.spotify.sdk.android.player.PlayerState) PlayerStateCallback(com.spotify.sdk.android.player.PlayerStateCallback)

Aggregations

PlayerState (com.spotify.sdk.android.player.PlayerState)1 PlayerStateCallback (com.spotify.sdk.android.player.PlayerStateCallback)1 MediaPlayerState (com.waz.zclient.controllers.mediaplayer.MediaPlayerState)1