Open jiayuzhang opened 8 years ago
Can you post the url that cause the problem? I had the same issue but most of the URLs are ok. E.g http://www.hubharp.com/web_sound/WalloonLilliShort.mp3
I also notice that the library work just fine when I archive the app and run on real device. I will keep an eye on that. Can you confirm in your case?
@jiayuzhang Hello, did you already managed how to fix this?
I'm not good in thread management, so I made a quickfix for this:
- (void)audioPlayer:(STKAudioPlayer *)audioPlayer didFinishPlayingQueueItemId:(NSObject *)queueItemId withReason:(STKAudioPlayerStopReason)stopReason andProgress:(double)progress andDuration:(double)duration
{
if (stopReason == STKAudioPlayerStopReasonNone)
{
__weak typeof(self) weakSelf = self;
[self bk_performBlock:^(id obj) {
[weakSelf checkPlayerRealStopReason];
} afterDelay:0.1];
}
// Switch to next track if EOF
}
- (void)checkPlayerRealStopReason
{
if (_streamingAudioPlayer.stopReason == STKAudioPlayerStopReasonEof)
{
// Switch to next track
}
}
It works, but I still hope that someone will fix this the right way.
+1, the same issue. How to fix it?
Also experiencing this issue, I do something similar to what @navern does, I check the player's stopReason after a millisecond, seems to work.
+1. Everything as said above
Expected STKAudioPlayerStopReasonEof, but got STKAudioPlayerStopReasonNone from
audioPlayer:didFinishPlayingQueueItemId:withReason:andProgress:andDuration
Here's a little background, my app maintains its own playlist (w/o using StreamingKit queue), only play one audio at a time, when my delegate receives didFinishPlayingQueueItemId and stopReason is EOF, it will go fetch the next one and play.
But, occasionally (very high odds) it got wrong stopReason, here's my observation
Seems like it is a mutlithreading issue, kinda of new to this library, anyone could help fixing it? THANKS