android-sdk icon indicating copy to clipboard operation
android-sdk copied to clipboard

Playing offline - no sound and no error messages

Open tobika opened this issue 6 years ago • 2 comments

Issue found on 17/01/2020.

SDK Version: 0.7.0

OS Version: Android 9

Scope(s): ['streaming', 'user-read-birthdate', 'user-read-email', 'user-read-private', 'app-remote-control', 'user-read-playback-state', 'user-modify-playback-state']

Spotify Version: 8.5.40.195

Steps to reproduce:

  1. Start app in airplane mode (connection to spotify app works)
  2. Play album spotify:album:4FxNfDSXqAg8N1D8NBtvZ5 with skipToIndex() or play()
  3. Nothing happens, no error is thrown, result of call is com.spotify.protocol.types.Empty@872db71

Expected behaviour:

Either it should play or I should receive an error.

Actual behaviour:

Nothing happens, no error is thrown, result of call is com.spotify.protocol.types.Empty@872db71

I receive the following state via subsciption:

PlayerState{track=null, isPaused=false, playbackSpeed=0.0, playbackPosition=0, playbackOptions=PlayerOptions{isShuffling=false, repeatMode=0}, playbackRestrictions=PlayerRestrictions{canSkipNext=false, canSkipPrev=false, canRepeatTrack=true, canRepeatContext=true, canToggleShuffle=true}}

My implementation:

        mSpotifyAppRemote.getPlayerApi().skipToIndex(uri, offset)
        .setResultCallback((result) -> {
            Log.d("SpotifyPlugin", "Start playing " + uri + " at offset " + offset +" and seek to " + position);
            Log.d("SpotifyPlugin", result.toString());
            if (position > 0) {
                mSpotifyAppRemote.getPlayerApi().seekTo(position);
            }
            call.success();
        }).setErrorCallback((throwable) -> {
            Log.e("SpotifyPlugin", "Error playing", throwable);

            call.reject(throwable.getMessage(), new Exception(throwable));
        });

I can see the Start playing in the log. But nothing happens.

I did some further testing in which I started playback while having network. Then I activated the airplane mode. Playback seems to continue track after track.

I can even interact with seek()/skip() and this works fine in offline mode. But as soon as I call skipToIndex() or play() the playback stops.

tobika avatar Jan 17 '20 12:01 tobika

Hi @tobika We are working on fixing this issue.

Thanks for your patience.

mdelolmo avatar Jan 20 '20 09:01 mdelolmo

@mdelolmo thank you so much. I just tried it today with the latest Spotify Update and it seems to work really well now :)

I have found a bug during offline playback. Using mSpotifyAppRemote.getPlayerApi().skipToIndex(uri, offset) for album playback with an offset of 149 works perfect. Using an offset of 150 or greater doesn't work.

Should I create another issue?

tobika avatar Mar 01 '21 20:03 tobika