【发布时间】:2015-12-03 15:14:24
【问题描述】:
所以我制作了一个允许用户从 spotify 流式传输歌曲的应用程序,我在播放和停止使用 spotify 播放器时没有问题。但是,我在暂停和恢复歌曲时遇到问题。
这是我的逻辑:
- 停止当前播放的曲目
- 当我停止 Spotify 播放器时获取当前播放位置
- 玩耍并寻找我得到的时间
这是我的代码:
var currentOffset = User.spotifyPlayer!.currentPlaybackPosition
println(currentOffset)
var spotifyTrackUrl : NSURL = NSURL(string: self.spotifyTrackUri!)!
User.spotifyPlayer!.playURIs([spotifyTrackUrl], fromIndex: 0, callback: { (error : NSError!) -> Void in
if error != nil {
println(error)
}else{
if User.spotifyPlayer!.isPlaying == true {
User.spotifyPlayer!.seekToOffset(currentOffset, callback: { (error : NSError!) -> Void in
if error != nil {
println("rene 3")
println("spotify seek error : \(error)")
}
sender.setImage(UIImage(named: "playicon.png"), forState: UIControlState.Normal)
println("rene 4")
})
}
}
})
我总是遇到以下错误:
spotify seek error : 由于未指定的问题,操作失败。
我使用的是 swift,但是如果你使用 obj-c,给我任何建议都没关系
【问题讨论】: