Ramis
Ramis

Reputation: 16519

SPTAudioStreamingController stop playURIs short buffer

If the Spotify stream was stopped by the user and then another Spotify stream is played, there's a short "buffer" where the old stream is playing before it switches to the new one. How to avoid short buffer to be played? Code example:

// User taps to play song.
[self.player playURIs:@[trackURI] withOptions:options callback:nil];

// User taps stop.
[self.player stop:nil];

// After some time user taps to play another song.
[self.player playURIs:@[trackURI] withOptions:options callback:nil]; // Short buffer played from old song.

Upvotes: 1

Views: 299

Answers (1)

Ramis
Ramis

Reputation: 16519

Work around for it is set is playing to NO and after completion execute stop.

[self.player setIsPlaying:NO callback:^(NSError *error) {
    [self.player stop:nil];
}];

Upvotes: 2

Related Questions