如果用户停止了Spotify流,然后播放了另一个Spotify流,那么在切换到新流之前,会有一个短的"缓冲区"在播放旧流。如何避免短缓冲被发挥?代码示例:
// 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.
工作的周围设置是播放到NO,完成后执行停止。
[self.player setIsPlaying:NO callback:^(NSError *error) {
[self.player stop:nil];
}];