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'沒有在任何地方被調用 –