Firstly, don't use SPAsyncLoading
for playback-related stuff - that's not what it's for, and SPPlaybackManager
doesn't confirm to <SPAsyncLoading>
anyway.
The isPlaying
property flips to YES
once the library has accepted the track for playback, and you should base your play/pause UI on this property. Due to latency and caching and whatnot, audio may take a little while to appear as you've seen.
The trackPosition
property, however, is updated as a direct result of audio being pushed to the speakers. Using a timer to watch this is overkill - just use KVO to observe the value and you'll always be in sync.
Be aware that SPPlaybackManager
is a very simple class designed for playing a single track. For more advanced playback, I recommend looking at the code of SPPlaybackManager
and using it for a base of your own class that uses the playback methods of SPSession
and SPCoreAudioController
directly - you'll get much better control over playback that way. The only Objective-C example of this I'm aware of is in the Viva project - specifically the VivaPlaybackManager
class over on GitHub. That class supports shuffle, local files playback, Last.fm etc so it may be too complicated, but it does multitrack playback just fine without losing a single sample.