yyqxiaoyin 5 rokov pred
rodič
commit
1f65825a21

+ 5 - 5
MKRRadioManager/Classes/MKRRadioManager/Headers/MKRPlayControlProtocol.h

@@ -104,7 +104,7 @@
  @param channelNO 频道号
  @param index 歌曲下标
  */
-- (void)playSongWithChannelNO:(NSInteger)channelNO index:(NSInteger)index userID:(NSString *)userID;
+- (void)playSongWithChannelNO:(NSInteger)channelNO index:(NSInteger)index;
 
 
 /**
@@ -112,7 +112,7 @@
  
  @param channelNO 频道号 从第一首开始播放
  */
-- (void)playSongWithChannelNO:(NSInteger)channelNO userID:(NSString *)userID;
+- (void)playSongWithChannelNO:(NSInteger)channelNO;
 
 
 /**
@@ -120,7 +120,7 @@
 
  @param songs 歌曲数组
  */
-- (void)playTempSongs:(NSArray <id <MKRRadioResorce>> *)songs userID:(NSString *)userID;
+- (void)playTempSongs:(NSArray <id <MKRRadioResorce>> *)songs;
 
 /**
  播放歌曲列表到临时列表
@@ -128,13 +128,13 @@
  @param songs 歌曲数组
  @param index 开始播放的下标
  */
-- (void)playTempSongs:(NSArray <id <MKRRadioResorce>> *)songs index:(NSInteger)index userID:(NSString *)userID;
+- (void)playTempSongs:(NSArray <id <MKRRadioResorce>> *)songs index:(NSInteger)index;
 
 /**
  更新播放列表
 
  @param newPlayList 目标播放列表
  */
-- (void)updatePlayList:(NSArray <id <MKRRadioResorce>> *)newPlayList userID:(NSString *)userID;
+- (void)updatePlayList:(NSArray <id <MKRRadioResorce>> *)newPlayList;
 
 @end

+ 8 - 10
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.h

@@ -58,11 +58,9 @@
  * 设置设备单首播放的资源
  * @param song 需要播放的资源
  * @param device 需要设置的设备
- * @param userID 用户ID
  */
 - (void)setAVTransportURIWithSong:(id <MKRRadioResorce>)song
-                           device:(id <MKRUPnPDevice>)device
-                           userID:(NSString *)userID;
+                           device:(id <MKRUPnPDevice>)device;
 
 /**
  * 播放
@@ -77,41 +75,41 @@
  * @param channelNO      频道号
  * @param index          需要播放的下标
  * @param device         播放的设备
- * @param userID         用户ID
+ * @param timeStamp      频道时间戳
  */
 - (void)playSongWithChannelNO:(NSInteger)channelNO
                         index:(NSInteger)index
                        device:(id <MKRUPnPDevice>)device
-                       userID:(NSString *)userID;
+                    timeStamp:(NSTimeInterval)timeStamp;
 /**
  * 播放channelNO频道 从第0首开始
  * @param channelNO 频道号
  * @param device    需要播放的设备
- * @param userID    用户ID
  */
 - (void)playSongWithChannelNO:(NSInteger)channelNO
                        device:(id <MKRUPnPDevice>)device
-                       userID:(NSString *)userID;
+                    timeStamp:(NSTimeInterval)timeStamp;
 
 /**
 * 播放临时频道频道(频道13) 从第index首开始
 * @param index          需要播放的下标
 * @param device    需要播放的设备
-* @param userID    用户ID
+* @param timeStamp      频道时间戳
 */
 - (void)playTempChannelSongs:(NSArray <id <MKRRadioResorce>> *)songs
                        index:(NSInteger)index
                       device:(id <MKRUPnPDevice>)device
-                      userID:(NSString *)userID;
+                   timeStamp:(NSTimeInterval)timeStamp;
 
 /**
 * 播放临时频道频道(频道13) 从第index首开始
 * @param device    需要播放的设备
 * @param userID    用户ID
+* @param timeStamp      频道时间戳
 */
 - (void)playTempChannelSongs:(NSArray <id <MKRRadioResorce>> *)songs
                       device:(id <MKRUPnPDevice>)device
-                      userID:(NSString *)userID;
+                   timeStamp:(NSTimeInterval)timeStamp;
 
 /**
  * 暂停

+ 16 - 14
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -347,10 +347,10 @@ static inline void wd_playControl_queue(void (^block)(void)){
 }
 
 - (void)setAVTransportURIWithSong:(id <MKRRadioResorce>)song
-                           device:(id <MKRUPnPDevice>)device
-                           userID:(NSString *)userID {
+                           device:(id <MKRUPnPDevice>)device{
     NSString *timestamp = [NSString stringWithFormat:@"%.0f", [[NSDate date] timeIntervalSince1970]];
     NSString *channelNumString = [NSString stringWithFormat:@"CHANNEL_UPDATE_%zd",song.songChannel];
+    NSString *userID = self.userID;
     libupnp_SetAVTransportURI(
     device.avTransportUrl,
     song.songUrl?:@"",
@@ -379,10 +379,11 @@ static inline void wd_playControl_queue(void (^block)(void)){
 - (void)playSongWithChannelNO:(NSInteger)channelNO
                         index:(NSInteger)index
                        device:(id <MKRUPnPDevice>)device
-                       userID:(NSString *)userID {
+                    timeStamp:(NSTimeInterval)timeStamp{
     NSString *playFlag = [NSString stringWithFormat:@"%zd-%zd",channelNO,index];
     NSString *playListUrl = [NSString stringWithFormat:@"%@/web/playlist",[ASControlTools sharedInstanceUPNP].myIp];
-    NSString *timestamp = [NSString stringWithFormat:@"%.0f", [[NSDate date] timeIntervalSince1970]];
+    NSString *timestamp = [NSString stringWithFormat:@"%.0f", timeStamp];
+    NSString *userID = self.userID;
     wd_playControl_queue(^{
         libupnp_PlayNumFlag(
         device.avTransportUrl,
@@ -398,10 +399,11 @@ static inline void wd_playControl_queue(void (^block)(void)){
 
 - (void)playSongWithChannelNO:(NSInteger)channelNO
                        device:(id <MKRUPnPDevice>)device
-                       userID:(NSString *)userID {
+                    timeStamp:(NSTimeInterval)timeStamp{
     NSString *playFlag = [NSString stringWithFormat:@"%zd",channelNO];
     NSString *playListUrl = [NSString stringWithFormat:@"%@/web/playlist",[ASControlTools sharedInstanceUPNP].myIp];
-    NSString *timestamp = [NSString stringWithFormat:@"%.0f", [[NSDate date] timeIntervalSince1970]];
+    NSString *timestamp = [NSString stringWithFormat:@"%.0f", timeStamp];
+    NSString *userID = self.userID;
     wd_playControl_queue(^{
         libupnp_PlayNumFlag(
         device.avTransportUrl,
@@ -417,27 +419,27 @@ static inline void wd_playControl_queue(void (^block)(void)){
 - (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
                        index:(NSInteger)index
                       device:(id<MKRUPnPDevice>)device
-                      userID:(NSString *)userID{
+                   timeStamp:(NSTimeInterval)timeStamp{
     MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
-    m3uModel.userID = userID;
+    m3uModel.userID = self.userID;
     m3uModel.playModeString = @"REPEAT_ALL";
     wd_playControl_queue(^{
         [[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
-        [self setAVTransportURIWithSong:songs[index] device:device userID:userID];
-        [self playSongWithChannelNO:13 index:index device:device userID:userID];
+        [self setAVTransportURIWithSong:songs[index] device:device];
+        [self playSongWithChannelNO:13 index:index device:device timeStamp:timeStamp];
     });
 }
 
 - (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
                       device:(id<MKRUPnPDevice>)device
-                      userID:(NSString *)userID{
+                   timeStamp:(NSTimeInterval)timeStamp{
     MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
-    m3uModel.userID = userID;
+    m3uModel.userID = self.userID;
     m3uModel.playModeString = @"REPEAT_ALL";
     wd_playControl_queue(^{
         [[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
-        [self setAVTransportURIWithSong:songs[0] device:device userID:userID];
-        [self playSongWithChannelNO:13 device:device userID:userID];
+        [self setAVTransportURIWithSong:songs[0] device:device];
+        [self playSongWithChannelNO:13 device:device timeStamp:timeStamp];
     });
 }