尹永奇 4 éve
szülő
commit
d17253562c

+ 4 - 3
MKRRadioManager/Classes/MKRRadioManager/MKRAVPlayer/MKRAVPlayer.m

@@ -417,9 +417,7 @@ NSURL * MKRUrlWithString(NSString *string){
         nextIndex = [self _caculateNextIndex:self.currentIndex];
         shouldAutoNext = [self.delegate didFinishPlayWillAutoNext:nextIndex];
     }
-    if (self.delegate && [self.delegate respondsToSelector:@selector(didFinishPlay:)]) {
-        [self.delegate didFinishPlay:self.currentIndex];
-    }
+    NSInteger finishIndex = self.currentIndex;
     if (shouldAutoNext) {
         [self nextWhenPlayDidEnd];
     }else{
@@ -434,6 +432,9 @@ NSURL * MKRUrlWithString(NSString *string){
         self.playUrl = MKRUrlWithString(url);
         self.state = MKRAVPlayerStateStopped;
     }
+    if (self.delegate && [self.delegate respondsToSelector:@selector(didFinishPlay:)]) {
+        [self.delegate didFinishPlay:self.currentIndex];
+    }
 }
 
 #pragma mark - setter