【问题标题】:cocoalibspotify error when attempting to play certain tracks尝试播放某些曲目时出现 cocoalibspotify 错误
【发布时间】:2012-05-30 06:54:43
【问题描述】:

我正在尝试使用 cocoalibspotify 从 SPArtistBrowse 的结果中播放热门曲目。大多数情况下,这可以完美运行,但偶尔会出现以下错误:

Error Domain=com.spotify.CocoaLibSpotify.error Code=3 "The track cannot be played"

这只发生在特定轨道上,并且对于受影响的轨道,它是一致且可重复的(例如,Armin van Buren 的顶级轨道,spotify:track:6q0f0zpByDs4Zk0heXZ3cO,在尝试使用下面的代码播放时总是会出现此错误)。奇怪的是,如果我使用简单的播放器示例应用程序并输入受影响曲目的 URL,则曲目播放正常;所以我的预感是它与从 SPArtistBrowse 加载的曲目有关。

这是我用来播放曲目的代码:

- (void)playTrack
{   
    SPTrack *track = [self.artistBrowse.topTracks objectAtIndex:self.currentTrackIndex];

    [SPAsyncLoading waitUntilLoaded:track then:^(NSArray *tracks) {
        [self.playbackManager playTrack:track callback:^(NSError *error) {

            if (error) {
                self.currentTrackIndex++;
                if (self.currentTrackIndex < self.artistBrowse.topTracks.count) {
                    [self playTrack];
                } else {
                    [self.activityIndicator stopAnimating];
                    self.activityIndicator.alpha = 0;
                    self.nowPlayingLabel.text = @"Spotify Error";
                }
            } else {
                [self.activityIndicator stopAnimating];
                self.activityIndicator.alpha = 0;
                self.nowPlayingLabel.text = track.name;

                // Set "Now Playing" info on the iOS remote control
                MPNowPlayingInfoCenter *infoCenter = [MPNowPlayingInfoCenter defaultCenter];
                NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
                [dic setValue:track.name forKey:MPMediaItemPropertyTitle];
                [dic setValue:self.artistLabel.text forKey:MPMediaItemPropertyArtist];
                infoCenter.nowPlayingInfo = dic;
            }
        }];
    }];
}

【问题讨论】:

  • 嗨,Matt Bridges,您解决了这个错误吗?

标签: ios spotify cocoalibspotify-2.0


【解决方案1】:

艺术家浏览应该影响任何事情 - 曲目就是曲目。但是,如果您可以可靠地重现它,请 fork CocoaLibSpotify 并将失败的单元测试添加到单元测试套件中 - 这样我们就可以修复它。

也有可能是 Spotify 播放服务在错误的时间不可用,但这种情况相当罕见。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-14
    • 1970-01-01
    • 1970-01-01
    • 2018-09-24
    • 1970-01-01
    • 2021-04-13
    • 1970-01-01
    相关资源
    最近更新 更多