Every once in a while when using Spotify player we encounter a stutter that lasts roughly ten seconds. While there are a few aspects that seem abnormal to me the most consistent sign that it is happening is that we hit the didStartPlayingTrack
delegate method more than once even though we only told the player to play once. Does anyone have any ideas what could cause this to occur?
Important note: this is spotify-ios-sdk version 0.21
A sample of the logs:
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackDelivered") // Last track ended
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyAudioDeliveryDone")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyPause")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
movePlayerPosition(_:completion:)[L:180]: seek successful to 0.842
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
13:13:50 audioStreaming(_:didStartPlayingTrack:)[L:377]: didStartPlayingTrack: Optional("So Far Away (Live) - Live")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackEventAudioFlush")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyPlay")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyMetadataChanged")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyContextChanged")
13:14:01 audioStreaming(_:didStartPlayingTrack:)[L:377]: didStartPlayingTrack: Optional("So Far Away (Live) - Live")
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackNotifyTrackChanged")
audioStreaming(_:didSeekToPosition:)[L:474]: did seek to position: 0.001
audioStreaming(_:didReceive:withName:)[L:412]: didReceiveEvent: Optional("SPPlaybackEventAudioFlush")
Is there anyway to prevent this stutter from occuring?
Update
I've switched to version 25 and I am still encountering the issue. The one noticeable trait in the stutter logs that I have found is that on most starts of songs I do not get a didSeekToPosition
delegate unless specifically requested; however when the stutter is encountered I see the following when stuttering begins:
audioStreaming(_:didStartPlayingTrack:)[L:377]: didStartPlayingTrack
audioStreaming(_:didSeekToPosition:)[L:474]: did seek to position: 0.001
Just to be clear, there is only one method that calls playSpotifyUri
; however, this didStartPlaying
delegate gets hit multiple times.
The iOS SDK is now at version Beta 25, have you considered upgrading? I'd recommend doing that and seeing if it resolves your problem.
I'd need to see your specific implementation in order to debug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With