Browse Source

版本升级维护

yyqxiaoyin 5 years ago
parent
commit
090fc84450

+ 26 - 0
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.h

@@ -133,6 +133,19 @@
                    timeStamp:(NSTimeInterval)timeStamp;
 
 /**
+* 播放临时频道频道(频道13)  从第index首开始
+* @param index          需要播放的下标
+* @param device         需要播放的设备
+* @param timeStamp      频道时间戳
+* @param playMode       播放模式
+*/
+- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
+                       index:(NSInteger)index
+                      device:(id<MKRUPnPDevice>)device
+                   timeStamp:(NSTimeInterval)timeStamp
+                    playMode:(MKRRadioPlayMode)playMode;
+
+/**
 * 播放临时频道频道(频道13)    从第index首开始
 * @param device           需要播放的设备
 * @param userID           用户ID
@@ -142,6 +155,19 @@
                       device:(id <MKRUPnPDevice>)device
                    timeStamp:(NSTimeInterval)timeStamp;
 
+
+/**
+* 播放临时频道频道(频道13)    从第index首开始
+* @param device           需要播放的设备
+* @param userID           用户ID
+* @param timeStamp        频道时间戳
+* @param playMode         播放模式
+*/
+- (void)playTempChannelSongs:(NSArray <id <MKRRadioResorce>> *)songs
+                      device:(id <MKRUPnPDevice>)device
+                   timeStamp:(NSTimeInterval)timeStamp
+                    playMode:(MKRRadioPlayMode)playMode;
+
 /**
  * 暂停
  * @param device 设备

+ 44 - 2
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -467,9 +467,17 @@ static inline void wd_playControl_queue(void (^block)(void)){
                        index:(NSInteger)index
                       device:(id<MKRUPnPDevice>)device
                    timeStamp:(NSTimeInterval)timeStamp{
+    [self playTempChannelSongs:songs index:index device:device timeStamp:timeStamp playMode:MKRRadioPlayModeOrder];
+}
+
+- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
+                       index:(NSInteger)index
+                      device:(id<MKRUPnPDevice>)device
+                   timeStamp:(NSTimeInterval)timeStamp
+                    playMode:(MKRRadioPlayMode)playMode{
     MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
     m3uModel.userID = self.userID;
-    m3uModel.playModeString = @"REPEAT_ALL";
+    m3uModel.playModeString = [self playModeStringWithPlayMode:playMode];
     wd_playControl_queue(^{
         [[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
         id <MKRRadioResorce> song = songs[index];
@@ -483,9 +491,16 @@ static inline void wd_playControl_queue(void (^block)(void)){
 - (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
                       device:(id<MKRUPnPDevice>)device
                    timeStamp:(NSTimeInterval)timeStamp{
+    [self playTempChannelSongs:songs device:device timeStamp:timeStamp playMode:MKRRadioPlayModeOrder];
+}
+
+- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
+                      device:(id<MKRUPnPDevice>)device
+                   timeStamp:(NSTimeInterval)timeStamp
+                    playMode:(MKRRadioPlayMode)playMode{
     MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
     m3uModel.userID = self.userID;
-    m3uModel.playModeString = @"REPEAT_ALL";
+    m3uModel.playModeString = [self playModeStringWithPlayMode:playMode];
     wd_playControl_queue(^{
         [[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
         id <MKRRadioResorce> song = songs[0];
@@ -685,6 +700,33 @@ static inline void wd_playControl_queue(void (^block)(void)){
     
 }
 
+- (NSString *)playModeStringWithPlayMode:(MKRRadioPlayMode)playmode{
+    switch (playmode) {
+        case MKRRadioPlayModeOrder:{
+            return @"REPEAT_ALL";
+        }
+            break;
+        case MKRRadioPlayModeSingle:{
+            return @"REPEAT_ONE";
+        }
+            break;
+        case MKRRadioPlayModeRandom:{
+            return @"SHUFFLE";
+        }
+            break;
+        default:{
+             return @"REPEAT_ALL";
+        }
+            break;
+    }
+}
+
+static NSString * const playModeStringMap[] = {
+    [MKRRadioPlayModeOrder] = @"列表循环",
+    [MKRRadioPlayModeSingle] = @"单曲循环",
+    [MKRRadioPlayModeRandom] = @"随机播放"
+};
+
 - (id<MKRRadioResorce>)currentResource{
     if (!_currentResource) {
         _currentResource = [[MKRRadioResorce alloc] init];