yyqxiaoyin 4 anni fa
parent
commit
9a6065af8c

+ 4 - 0
MKRRadioManager/Classes/MKRRadioManager/MKRAVPlayer/MKRAVPlayer.h

@@ -65,6 +65,10 @@ typedef enum : NSUInteger {
 /// @param index 准备播放的资源在播放列表的下标
 - (BOOL)willPreparePlayAtIndex:(NSInteger)index;
 
+/// 即将切换播放资源
+/// @param resource 即将播放的资源 此方法触发时 currentResource 还是上一个播放的资源
+- (void)willChangePlayResouce:(id<MKRRadioResorce>)resource;
+
 /**
  播放完成
  

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

@@ -262,6 +262,9 @@ NSURL * MKRUrlWithString(NSString *string){
 }
 
 - (void)resetPlayer{
+    if ([self.delegate respondsToSelector:@selector(willChangePlayResouce:)]) {
+        [self.delegate willChangePlayResouce:self.currentResource];
+    }
     self.totalTime = 0;
 //    self.currentTime = 0;
     self.playerItem = nil;