2
我正在开发使用spotify-iOS-SDK的应用程序,我已成功将我的应用程序连接到Spotify,并且音频播放正常,但问题是:当我激活静音模式时,尽管Spotify音乐仍在播放,但我的应用没有声音。我已经检查使用Spotify的-IOS-SDK(示范项目,MusixMatch),他们都可以释放声音iOS:在静音模式下播放Spotify音频
这里的其他应用是我的代码:
self.spotifyPlayer = SPTAudioStreamingController.sharedInstance()
self.spotifyPlayer!.playbackDelegate = self
self.spotifyPlayer!.delegate = self
try! spotifyPlayer?.start(withClientId: auth.clientID)
self.spotifyPlayer!.login(withAccessToken: authSession.accessToken)
那么,这个函数会被调用:
func audioStreamingDidLogin(_ audioStreaming: SPTAudioStreamingController!) {
let uri = "spotify:track:" + trackId
self.spotifyPlayer?.playSpotifyURI(uri, startingWith: 0, startingWithPosition: 0, callback: { (error) in
if (error != nil) {
print("error: \(error) ")
}
})
}
请问'didStartPlayingTrack'代表被打中?你可能想看看'audioStreamingDidBecomeInactivePlaybackDevice'和'didReceiveError'委托方法。 –
'didStartPlayingTrack'运行平稳,在音轨播放后我也调用了一些函数,在我的PlaySongViewController关闭后调用'audioStreamingDidBecomeInactivePlaybackDevice',不是因为我沉默了我的电话,而且'didReceiveError'没有在任何地方被调用 –