Hi Aure,
I didn't played with the new cooked AKAudioPlayer yet, but after I made some experiments, I think we miss an "isPlaying" property for AKPlayer.
I tried to expose the internalPlayer.playing property with no success, it is not reliable, as it is always true even if the player reached the end of the file.
According AKAudioPlayer documention,
public var isStarted: Bool
should tell whether or not the audio player is currently playing.
But even if the player doesn't play anymore, this property is still set to true.
That's why I implemented my custom isPlaying property, automatically set to false when completionHandler is triggered.
I'm not very proud of how I did it, and I'm sure it can be done in a cleaner way.
But It would be handy to have a public reliable "isPlaying" property.
Another thought about AKMIDICallback and AKAudioPlayer completion handler :
I got a "This application is modifying the autolayout engine from a background
thread,...." Error when I attach a function that try to update the UI.
It can be fixed using
dispatch_async(dispatch_get_main_queue()...But I'm questioning myself if it may corrupt the sequencer accuracy and internal AudioKit behavior.
Could a foreground function call from a background thread affect the background thread in a undesirable way ?
May be this point and the "
dispatch_async" trick should be mentioned this in AKMIDICallback and AKAudioPlayer documentation... (?)
I'm very busy until next tuesday but I'll do some more tests using the new AKMIDICallback as soon as I can.
:-)
Laurent.