Explorar o código

版本升级维护

yyqxiaoyin %!s(int64=5) %!d(string=hai) anos
pai
achega
167ddc22ca

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

@@ -609,6 +609,12 @@ static inline void wd_playControl_queue(void (^block)(void)){
         if (!resultDic || !resultDic.allKeys.count) {
             return ;
         }
+        if ([resultDic[@"TrackMetaData"][@"upnp:songInfoID"] isKindOfClass:NSString.class]) {
+            NSInteger songID = [resultDic[@"TrackMetaData"][@"upnp:songInfoID"] integerValue];
+            if (songID != self.currentResource.songID) {
+                self.currentResource = [self defaultSong];
+            }
+        }
         @synchronized (self.currentResource) {
             if ([resultDic[@"TrackMetaData"][@"upnp:songType"] isKindOfClass:NSString.class]) {
                 NSInteger sourceType = [MKRM3UListModel convertSorceTypeWithAudioType:[resultDic[@"TrackMetaData"][@"upnp:songType"] integerValue]];
@@ -690,6 +696,14 @@ static inline void wd_playControl_queue(void (^block)(void)){
     return _currentResource;
 }
 
+- (id<MKRRadioResorce>)defaultSong{
+    MKRRadioResorce *song = [[MKRRadioResorce alloc] init];
+    song.songName = @"猫王妙播";
+    song.songArtist = @"Keep radio on!";
+    song.resourceStatus = [[MKRPlayResourceStatus alloc] init];
+    return song;
+}
+
 - (NSHashTable *)listeners{
     if (!_listeners) {
         _listeners = [NSHashTable weakObjectsHashTable];