Jelajahi Sumber

版本升级维护

yyqxiaoyin 5 tahun lalu
induk
melakukan
e9b6361b61

+ 7 - 0
MKRRadioManager/Classes/MKRRadioManager/Headers/MKRPlayControlProtocol.h

@@ -114,4 +114,11 @@
  */
 - (void)playTempSongs:(NSArray <id <MKRRadioResorce>> *)songs index:(NSInteger)index userID:(NSString *)userID;
 
+/**
+ 更新播放列表
+
+ @param newPlayList 目标播放列表
+ */
+- (void)updatePlayList:(NSArray <id <MKRRadioResorce>> *)newPlayList userID:(NSString *)userID;
+
 @end

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

@@ -89,6 +89,8 @@ typedef enum : NSUInteger {
 
 - (id)initWithObjectsPlayList:(NSArray<id<MKRRadioResorce>> *)playList playMode:(MKRAVPlayerPlayMode)playMode;
 
+- (void)updatePlayList:(NSArray<NSString *> *)playList;
+
 @property(nonatomic, weak) id<MKRAVPlayerDelegate> delegate;
 
 /**

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

@@ -104,6 +104,14 @@ NSURL * MKRUrlWithString(NSString *string){
     return [self initWithPlayList:urls playMode:playMode];
 }
 
+- (void)updatePlayList:(NSArray<NSString *> *)playList{
+    self.playList = playList;
+    NSUInteger index = [playList indexOfObject:self.playUrl.absoluteString];
+    if (index != NSNotFound) {
+        self.currentIndex = index;
+    }
+}
+
 #pragma mark - 播放相关
 
 - (void)play{