Browse Source

1.音频播放器缓存

huangxiaodong 11 months ago
parent
commit
274490f8cd

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -1154,6 +1154,10 @@
 		6BF0F3D52AD3937B000AA133 /* DeviceThirdIdModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF0F3D32AD3937B000AA133 /* DeviceThirdIdModel.h */; };
 		6BF0F3D62AD3937B000AA133 /* DeviceThirdIdModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF0F3D42AD3937B000AA133 /* DeviceThirdIdModel.m */; };
 		6BF0F3D82AD3DB3C000AA133 /* planet.1ali_3ry_peer in Resources */ = {isa = PBXBuildFile; fileRef = 6BF0F3D72AD3DB3C000AA133 /* planet.1ali_3ry_peer */; };
+		6BF2A5AC2C4686C500872525 /* audioPlayDownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF2A5AA2C4686C400872525 /* audioPlayDownloadManager.h */; };
+		6BF2A5AD2C4686C500872525 /* audioPlayDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2A5AB2C4686C400872525 /* audioPlayDownloadManager.m */; };
+		6BF2A5AE2C4686C500872525 /* audioPlayDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF2A5AB2C4686C400872525 /* audioPlayDownloadManager.m */; };
+		6BF2A5AF2C4686C500872525 /* audioPlayDownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF2A5AA2C4686C400872525 /* audioPlayDownloadManager.h */; };
 		6BF52C962AD5546500A617DB /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF52C902AD5546500A617DB /* Reachability.m */; };
 		6BF52C972AD5546500A617DB /* SimplePing.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF52C912AD5546500A617DB /* SimplePing.h */; };
 		6BF52C982AD5546500A617DB /* WHPingTester.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF52C922AD5546500A617DB /* WHPingTester.h */; };
@@ -1908,6 +1912,8 @@
 		6BF0F3D32AD3937B000AA133 /* DeviceThirdIdModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceThirdIdModel.h; sourceTree = "<group>"; };
 		6BF0F3D42AD3937B000AA133 /* DeviceThirdIdModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeviceThirdIdModel.m; sourceTree = "<group>"; };
 		6BF0F3D72AD3DB3C000AA133 /* planet.1ali_3ry_peer */ = {isa = PBXFileReference; lastKnownFileType = file; path = planet.1ali_3ry_peer; sourceTree = "<group>"; };
+		6BF2A5AA2C4686C400872525 /* audioPlayDownloadManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = audioPlayDownloadManager.h; sourceTree = "<group>"; };
+		6BF2A5AB2C4686C400872525 /* audioPlayDownloadManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = audioPlayDownloadManager.m; sourceTree = "<group>"; };
 		6BF52C902AD5546500A617DB /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = "<group>"; };
 		6BF52C912AD5546500A617DB /* SimplePing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimplePing.h; sourceTree = "<group>"; };
 		6BF52C922AD5546500A617DB /* WHPingTester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WHPingTester.h; sourceTree = "<group>"; };
@@ -3168,6 +3174,8 @@
 				6B8A5ADF2C3BCC0E00E40B19 /* lastFileModel.m */,
 				6BF558BD2C4515B500701854 /* audioPlayListManager.h */,
 				6BF558BE2C4515B500701854 /* audioPlayListManager.m */,
+				6BF2A5AA2C4686C400872525 /* audioPlayDownloadManager.h */,
+				6BF2A5AB2C4686C400872525 /* audioPlayDownloadManager.m */,
 			);
 			path = recenFile;
 			sourceTree = "<group>";
@@ -3784,6 +3792,7 @@
 				6B2C1E302C070ADE00FDCF82 /* ZFNetworkSpeedMonitor.h in Headers */,
 				6B7EA7B02BF73DEB002D5CC2 /* addShareModel.h in Headers */,
 				6B2C1EAC2C070ADF00FDCF82 /* ZFIJKPlayerManager.h in Headers */,
+				6BF2A5AC2C4686C500872525 /* audioPlayDownloadManager.h in Headers */,
 				6B4C0F7A2C0314BA0070EF2E /* DFPlayerModel.h in Headers */,
 				6B21708C2B14BDAA00656670 /* couldphoneSysInfoModel.h in Headers */,
 				6B72724F2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h in Headers */,
@@ -4042,6 +4051,7 @@
 				6B2C1E312C070ADE00FDCF82 /* ZFNetworkSpeedMonitor.h in Headers */,
 				6B7EA7B22BF73DEB002D5CC2 /* addShareModel.h in Headers */,
 				6B2C1EAD2C070ADF00FDCF82 /* ZFIJKPlayerManager.h in Headers */,
+				6BF2A5AF2C4686C500872525 /* audioPlayDownloadManager.h in Headers */,
 				6B4C0F7B2C0314BA0070EF2E /* DFPlayerModel.h in Headers */,
 				6BD506D42B9576A4006E7CB0 /* couldphoneSysInfoModel.h in Headers */,
 				6BD506D52B9576A4006E7CB0 /* uploadFileRecordEditBottomView.h in Headers */,
@@ -4679,6 +4689,7 @@
 				6BD507502B9576A4006E7CB0 /* LogoSelectView.m in Sources */,
 				6B679DED2C252A4E00D0DC03 /* NASMySpaceViewController.m in Sources */,
 				6B2C1EA72C070ADE00FDCF82 /* ZFPresentTransition.m in Sources */,
+				6BF2A5AE2C4686C500872525 /* audioPlayDownloadManager.m in Sources */,
 				6BD507512B9576A4006E7CB0 /* TZAssetModel+imageData.m in Sources */,
 				6BD507522B9576A4006E7CB0 /* diskListTableCell.m in Sources */,
 				6B7DDF292C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.m in Sources */,
@@ -5019,6 +5030,7 @@
 				181E85012A8F6B1800292B96 /* LogoSelectView.m in Sources */,
 				6B679DEB2C252A4E00D0DC03 /* NASMySpaceViewController.m in Sources */,
 				6B2C1EA62C070ADE00FDCF82 /* ZFPresentTransition.m in Sources */,
+				6BF2A5AD2C4686C500872525 /* audioPlayDownloadManager.m in Sources */,
 				6B0582792AFF7C6D00D37290 /* TZAssetModel+imageData.m in Sources */,
 				6B45C5092B5FA2DD007E6911 /* diskListTableCell.m in Sources */,
 				6B7DDF272C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.m in Sources */,

+ 1 - 1
创维盒子/双子星云手机/AppDelegate/SceneDelegate.m

@@ -1372,7 +1372,7 @@
     else if(index == 1){
         eventValue = @"Cloud";
     }
-    else if(index == 1){
+    else if(index == 2){
         eventValue = @"Home";
     }
     

+ 48 - 12
创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.m

@@ -36,7 +36,7 @@
 @property (nonatomic, strong)UIButton * playModelBtn;//播放模式(单机 随机 循环)
 
 @property (nonatomic, assign) NSInteger index;//当前位置
-@property (nonatomic, strong) NSMutableArray * allAudioDataArray;//所有的 播放数据(NASFileAudioDataModel或者lastFileModel)
+@property (nonatomic, strong) NSMutableArray * allAudioDataArray;//所有的 播放数据(lastFileModel)
 
 @property (nonatomic, strong) NSMutableArray<DFPlayerModel *> *dataArray;
 @property (nonatomic, assign) NSInteger lastAudioIndex;//-1未记录
@@ -601,7 +601,7 @@
     if(localList.count > 0){
         for (NSInteger i = 0; i < localList.count; i++)
         {
-            NASFileAudioDataModel *yourModel = localList[i];
+            lastFileModel *yourModel = localList[i];
             DFPlayerModel *model = [[DFPlayerModel alloc] init];
             model.audioId = i;//****重要。AudioId从0开始,仅标识当前音频在数组中的位置。
             
@@ -624,11 +624,21 @@
     if(_isfirstEnterType){
         
         //把外面传入的音频作为第一次传入
-        NASFileAudioDataModel *yourModel = _outSideDataModel;
+        lastFileModel *lastFileMod = [lastFileModel new];
+        lastFileMod.path = _outSideDataModel.path;
+        lastFileMod.name = _outSideDataModel.name;
+        lastFileMod.time = _outSideDataModel.time;
+        lastFileMod.size = _outSideDataModel.size;
+        lastFileMod.duration = _outSideDataModel.duration;
+        lastFileMod.type = @"audio";
+        lastFileMod.lastPreTime = [iTools getNowTimeStamp];
+        //本地缓存
+        lastFileMod.localPath = [[audioPlayListManager shareManager] getAudioCacheFullPathBy:_outSideDataModel.name];
+        
         DFPlayerModel *model = [[DFPlayerModel alloc] init];
         model.audioId = 0;//****重要。AudioId从0开始,仅标识当前音频在数组中的位置。
 
-        NSString *filePath = yourModel.path;
+        NSString *filePath = lastFileMod.path;
         
         BOOL isInLocalListType = NO;
         
@@ -652,7 +662,7 @@
             model.audioUrl = curURL;
             HLog(@"%@",curURL.absoluteString);
             [_dataArray insertObject:model atIndex:0];
-            [_allAudioDataArray insertObject:yourModel atIndex:0];
+            [_allAudioDataArray insertObject:lastFileMod atIndex:0];
             
             //有数据插入 重新排序audioId
             for (NSInteger i = 0; i < _dataArray.count; i++) {
@@ -671,14 +681,11 @@
     
     return [_dataArray copy];
     
-    //        if ([yourModel.yourUrl hasPrefix:@"http"]) {//网络音频
-    //            model.audioUrl = [self getAvailableURL:yourModel.yourUrl];
-    //        }else{//本地音频
+    //本地音频
     //            NSString *path = [[NSBundle mainBundle] pathForResource:yourModel.yourUrl ofType:@""];
     //            if (path) {
     //                model.audioUrl = [NSURL fileURLWithPath:path];
     //            }
-    //        }
     
 }
 - (DFPlayerInfoModel *)df_audioInfoForPlayer:(DFPlayer *)player{
@@ -757,10 +764,10 @@
     
     if(_isfirstEnterType){
         KWeakSelf
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
             [weakSelf playAudioFun];
+            self->_isfirstEnterType = NO;
         });
-        _isfirstEnterType = NO;
     }
     
 }
@@ -774,13 +781,15 @@
 -(void)setTitleFunByIndex
 {
     if(_index < _allAudioDataArray.count){
-        NASFileAudioDataModel* dataModel = _allAudioDataArray[_index];
+        lastFileModel* dataModel = _allAudioDataArray[_index];
         //self.titleLabel.text = dataModel.name;
         _AudioTitleLab.text = dataModel.name;
         
         if(_audioPlayListV){
             _audioPlayListV.playingIndex = _index;
         }
+        
+        //[self downloadAudiodBy:dataModel];
     }
 }
 
@@ -806,6 +815,9 @@
         lastFileMod.type = @"audio";
         lastFileMod.lastPreTime = [iTools getNowTimeStamp];
         
+        //本地缓存
+        lastFileMod.localPath = [[audioPlayListManager shareManager] getAudioCacheFullPathBy:dataModel.name];
+        
         [[lastFileManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];
         [[audioPlayListManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];
         
@@ -880,4 +892,28 @@
     view.center = CGPointMake (view.center.x - transition.x, view.center.y - transition.y);
 }
 
+#pragma mark 下载音频文件到缓存
+- (void)downloadAudiodBy:(lastFileModel*)model
+{
+    if(model.isDownDoneType){
+        return;
+    }
+    
+    if(!model.localPath || model.localPath.length ==0){
+        model.localPath = [[audioPlayListManager  shareManager] getAudioCacheFullPathBy:model.path];
+    }
+    
+    NSString *filePath = model.path;
+    NSString *urlStr = ksharedAppDelegate.NASFileByBoxService;
+
+    NSString *filePathBase64 = [iTools base64UrlEncoder:filePath];
+    
+    NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles/%@",urlStr,filePathBase64];
+    
+    [[netWorkManager shareInstance] cloudPhoneDownloadAudioByCode:fileUrl withSavePath:model.localPath success:^(id  _Nonnull responseObject) {
+        HLog(@"responseObject:%@",responseObject);
+    } failure:^(NSError * _Nonnull error) {
+        
+    }];
+}
 @end

+ 4 - 4
创维盒子/双子星云手机/Class/Set/previewFile/previewFileAndFolderSecondViewController.m

@@ -570,11 +570,11 @@
     
     //KWeakSelf
     /*弹窗提示恢复出厂*/
-    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:@""
                                                                                      msg:NSLocalizedString(@"upload_download_need_read_msg",nil)
-                                                                                imageStr:nil
+                                                                                imageStr:@""
                                                                              cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
-                                                                                 okTitle:nil
+                                                                                 okTitle:@""
                                                                         isOkBtnHighlight:NO
                                                                               didClickOk:^{
         
@@ -702,7 +702,7 @@
     KWeakSelf
     ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
                                                                                       msg:tipStr
-                                                                                 imageStr:nil
+                                                                                 imageStr:@""
                                                                               cancelTitle:NSLocalizedString(@"other_cancel",nil)
                                                                                   okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
                                                                                didClickOk:^{

+ 6 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/customDownloadManager/customDownloadOperation.h

@@ -7,6 +7,9 @@
 
 #import <Foundation/Foundation.h>
 
+//音频播放下载 加入 后续可以单独删除
+#import "audioPlayListManager.h"
+
 /** 下载状态*/
 typedef  enum : NSUInteger {
     //customDownloadStateWaiting = 0,   /** 下载等待中 */
@@ -62,6 +65,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 // 创建下载操作任务
 - (instancetype)initWith:(NSString *)url session:(NSURLSession *)session;
+// downloadType 不传 即为原来的 分享链接唤起的下载
+// downloadType audioPlayCache 为音乐播放下载缓存
+- (instancetype)initWith:(NSString *)url session:(NSURLSession *)session withType:(NSString*)downloadType;
 
 - (NSDictionary *)downLoadInfoWithFinished:(BOOL)finished;
 @end

+ 27 - 8
创维盒子/双子星云手机/Class/Set/uploadFile/customDownloadManager/customDownloadOperation.m

@@ -9,6 +9,12 @@
 #import "customDownloadCacheManager.h"
 #import "NSURLSession+customDownloadTask.h"
 
+static NSString *downloadOperationType;
+
+@interface customDownloadOperation ()
+//@property(nonatomic,copy)NSString *downloadType;
+@end
+
 @implementation customDownloadOperation
 
 - (instancetype)initWith:(NSString *)url session:(NSURLSession *)session{
@@ -21,14 +27,23 @@
         NSString * decodeUrlFileName= [urlFileName stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
         self.fileName = decodeUrlFileName;
         
-        NSString* fileFullDir = [customDownloadCacheManager getFullDirector];
-        // 创建文件储存路径
-        if (![[NSFileManager defaultManager] fileExistsAtPath:fileFullDir]) {
-            [[NSFileManager defaultManager] createDirectoryAtPath:fileFullDir withIntermediateDirectories:YES attributes:nil error:nil];
+        if(downloadOperationType && [downloadOperationType isEqualToString:@"audioPlayCache"]){
+            
+            NSString* fileFullDir = [[audioPlayListManager shareManager] getAudioCacheFullPathBy:self.fileName];
+            // 设置下载路径
+            self.fullPath = fileFullDir;
+            downloadOperationType = @"";
         }
-
-        // 设置下载路径
-        self.fullPath = [fileFullDir stringByAppendingPathComponent:self.fileName];
+        else{
+            NSString* fileFullDir = [customDownloadCacheManager getFullDirector];
+            // 创建文件储存路径
+            if (![[NSFileManager defaultManager] fileExistsAtPath:fileFullDir]) {
+                [[NSFileManager defaultManager] createDirectoryAtPath:fileFullDir withIntermediateDirectories:YES attributes:nil error:nil];
+            }
+            // 设置下载路径
+            self.fullPath = [fileFullDir stringByAppendingPathComponent:self.fileName];
+        }
+        
         
         _currentSize = [customDownloadCacheManager getFileSizeWithURL:url];
         
@@ -50,7 +65,11 @@
     return _dataTask ? self : nil;
 }
 
-
+- (instancetype)initWith:(NSString *)url session:(NSURLSession *)session withType:(NSString*)downloadType
+{
+    downloadOperationType = downloadType;
+    return [[customDownloadOperation alloc] initWith:url session:session];
+}
 
 #pragma mark - setups
 

+ 43 - 0
创维盒子/双子星云手机/NAS/recenFile/audioPlayDownloadManager.h

@@ -0,0 +1,43 @@
+//
+//  audioPlayDownloadManager.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/16.
+//
+
+#import <Foundation/Foundation.h>
+#import "customDownloadOperation.h"
+
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface audioPlayDownloadManager : NSObject
+
+@property(nonatomic,strong) NSString *uid;//用户id 用来创建文件夹路径 防止不要用户的缓存关联
+@property(nonatomic,assign) NSInteger maxDownLoadCount;//默认2个
+@property(nonatomic,assign) BOOL isDownLoadIngType;//
+
+/** 实例化对象(单例) */
++ (instancetype)shareManager;
+
+#pragma mark - 队列中的任务进行操作
+
+/** 添加要下载的 网络连接  */
+- (void)addDownloadWithURLs:(NSArray *)urls;
+//在添加下载地址后 启动下载
+//- (void)beginDownload;
+
+/** 开始任务(不会自动添加任务,列队中没有就直接返回) 后续改为会自动添加任务 */
+- (void)startDownLoadWithUrl:(NSString *)url;
+
+/** 暂停任务(暂停下载url内容的任务) */
+- (void)supendDownloadWithUrl:(NSString *)url;
+
+/** 暂停当前所有的下载任务 下载任务不会从列队中删除 */
+- (void)suspendAllDownloadTask;
+
+/** 删除任务(删除下载url内容的任务) */
+- (void)deleteDownloadWithUrl:(NSString *)url;
+@end
+
+NS_ASSUME_NONNULL_END

+ 556 - 0
创维盒子/双子星云手机/NAS/recenFile/audioPlayDownloadManager.m

@@ -0,0 +1,556 @@
+//
+//  audioPlayDownloadManager.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/16.
+//
+
+#import "audioPlayDownloadManager.h"
+#import "customDownloadOperation.h"
+#import "customDownloadCacheManager.h"
+
+@interface audioPlayDownloadManager ()<NSURLSessionDataDelegate>
+//排队等候下载的下载地址数组
+@property(nonatomic,strong) NSMutableArray *downloadWaitingUrlArr;
+//正在下载的下载地址数组
+@property(nonatomic,strong) NSMutableArray *downloadingOperationArr;
+@end
+
+@implementation audioPlayDownloadManager
++ (instancetype)shareManager {
+    static audioPlayDownloadManager *_instance;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        _instance = [[self alloc] init];
+    });
+    return _instance;
+}
+
+- (instancetype)init {
+
+    if (self = [super init]) {
+        _maxDownLoadCount = 2;
+        //[self registeNotification];
+    }
+    return self;
+}
+
+- (NSString*)uid{
+    if(!_uid || _uid.length == 0){
+        return @"customUserName";
+    }
+    
+    return _uid;
+}
+
+/** 添加要下载的 网络连接  */
+- (void)addDownloadWithURLs:(NSArray *)urls{
+    
+    for (NSString *addUrl in urls) {
+        BOOL needAddType = YES;
+        
+        //1. 排查下载中
+        for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+            if([operationDoing.url isEqualToString:addUrl]){
+                needAddType = NO;
+                break;
+            }
+        }
+        
+        //1. 排查等待下载
+        for (NSString *waitUrl in self.downloadWaitingUrlArr) {
+            if([waitUrl isEqualToString:addUrl]){
+                needAddType = NO;
+                break;
+            }
+        }
+        
+        if(needAddType){
+            [self.downloadWaitingUrlArr addObject:addUrl];
+        }
+    }
+    
+    //启动下载
+    [self beginDownload];
+}
+
+//在添加下载地址后 启动下载
+- (void)beginDownload
+{
+    @synchronized (self) {
+        if(self.downloadingOperationArr.count == _maxDownLoadCount){
+            HLog(@"正在下载的数量达到了最大值 %ld",_maxDownLoadCount)
+            return;
+        }
+        
+        if(self.downloadWaitingUrlArr.count == 0){
+            HLog(@"没有等待中的下载任务")
+            return;
+        }
+        
+        NSInteger canAddTaskNumber = _maxDownLoadCount - self.downloadingOperationArr.count;
+        
+        for (int i=0; i<canAddTaskNumber; i++) {
+            
+            if(self.downloadWaitingUrlArr.count >= 1){
+                //创建下载任务
+                NSString *downloadUrl = self.downloadWaitingUrlArr.firstObject;
+                
+                NSURLSession *session = [self creatNewSessionFun];
+                customDownloadOperation * operation = [[customDownloadOperation alloc] initWith:downloadUrl session:session withType:@"audioPlayCache"];
+                [operation.dataTask resume];
+                
+                //等待下载中的任务
+                [self.downloadWaitingUrlArr removeObjectAtIndex:0];
+                //添加到下载中数组
+                [self.downloadingOperationArr addObject:operation];
+            }
+            
+        }
+    
+    }
+    
+}
+
+/** 开始任务(不会自动添加任务,列队中没有就直接返回) 后续改为会自动添加任务 */
+- (void)startDownLoadWithUrl:(NSString *)url
+{
+    
+    BOOL needAddType = YES;
+    
+    //1. 排查下载中
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if([operationDoing.url isEqualToString:url]){
+            needAddType = NO;
+            break;
+        }
+    }
+    
+    //1. 排查等待下载
+    for (NSString *waitUrl in self.downloadWaitingUrlArr) {
+        if([waitUrl isEqualToString:url]){
+            needAddType = NO;
+            break;
+        }
+    }
+    
+    if(needAddType){
+        [self.downloadWaitingUrlArr addObject:url];
+    }
+    
+    //启动下载
+    [self beginDownload];
+}
+
+/** 删除任务(删除下载url内容的任务) */
+- (void)deleteDownloadWithUrl:(NSString *)url
+{
+    //1.检测等待下载的任务
+    for (NSString*waitingUrl in self.downloadWaitingUrlArr) {
+        if ([waitingUrl isEqualToString:url]) {
+            [self.downloadWaitingUrlArr removeObject:waitingUrl];
+            break;
+        }
+    }
+    
+    //2.检测下载中的任务
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if([operationDoing.url isEqualToString:url]){
+            [operationDoing.dataTask cancel];
+//            operationDoing.dataTask = nil;
+//            operationDoing.session = nil;
+//
+//            [operationDoing.handle closeFile];
+//            operationDoing.handle = nil;
+//
+//            [self.downloadingOperationArr removeObject:operationDoing];
+            break;
+        }
+    }
+    
+    //3. 删除本地文件
+    [customDownloadCacheManager deleteFileWithUrl:url];
+    
+    //4.进行下一个任务
+    //[self beginDownload];
+}
+
+/** 暂停任务(暂停下载url内容的任务) */
+- (void)supendDownloadWithUrl:(NSString *)url
+{
+    //1.检测等待下载的任务
+    for (NSString*waitingUrl in self.downloadWaitingUrlArr) {
+        if ([waitingUrl isEqualToString:url]) {
+            [self.downloadWaitingUrlArr removeObject:waitingUrl];
+            break;
+        }
+    }
+    
+    //2.检测下载中的任务
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if([operationDoing.url isEqualToString:url]){
+            operationDoing.isManualCancel = YES;
+            
+            if(operationDoing.dataTask){
+                [operationDoing.dataTask cancel];
+            }
+//            operationDoing.dataTask = nil;
+//            operationDoing.session = nil;
+//
+//            [operationDoing.handle closeFile];
+//            operationDoing.handle = nil;
+//
+//            //删除后 didCompleteWithError 不再处理
+//            [self.downloadingOperationArr removeObject:operationDoing];
+           
+            break;
+        }
+    }
+    
+    //进行下一个任务
+    //[self beginDownload];
+}
+
+/** 暂停当前所有的下载任务 下载任务不会从列队中删除 */
+- (void)suspendAllDownloadTask
+{
+    //1.删除等待下载的任务
+    [self.downloadWaitingUrlArr removeAllObjects];
+    
+    //2.检测下载中的任务
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        operationDoing.isManualCancel = YES;
+        if(operationDoing.dataTask){
+            [operationDoing.dataTask cancel];
+        }
+        
+//        operationDoing.dataTask = nil;
+//        operationDoing.session = nil;
+//        [operationDoing.handle closeFile];
+//        operationDoing.handle = nil;
+    }
+
+    [self.downloadingOperationArr removeAllObjects];
+}
+
+#pragma mark 重新启动因为网络失败而停止的任务
+- (void)reDownloadNetworkTaskBy:(NSString*)url
+{
+    @synchronized (self) {
+        [self.downloadWaitingUrlArr insertObject:url atIndex:0];
+    }
+    
+    [self beginDownload];
+}
+
+#pragma mark - <NSURLSessionDataDelegate>
+
+// ssl 服务 证书信任
+- (void)URLSession:(NSURLSession *)session
+didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
+ completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{
+    if(![challenge.protectionSpace.authenticationMethod isEqualToString:@"NSURLAuthenticationMethodServerTrust"]) {
+        return;
+    }
+    
+    // 信任该插件
+    NSURLCredential *credential = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust];
+    // 第一个参数 告诉系统如何处置
+    completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
+}
+
+//当请求协议是https的时候回调用该方法
+//Challenge 挑战 质询(受保护空间)
+//NSURLAuthenticationMethodServerTrust 服务器信任证书
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
+ completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * __nullable credential))completionHandler {
+    
+    if(![challenge.protectionSpace.authenticationMethod isEqualToString:@"NSURLAuthenticationMethodServerTrust"]) {
+        return;
+    }
+    
+    // 信任该插件
+    NSURLCredential *credential = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust];
+    // 第一个参数 告诉系统如何处置
+    completionHandler(NSURLSessionAuthChallengeUseCredential,credential);
+    
+}
+
+
+// 接受到响应调用
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+didReceiveResponse:(NSURLResponse *)response
+ completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {
+    
+    // 将响应交给列队处理
+    BOOL canDownload =  [self handleOperateby:dataTask WithResponse:response];
+    
+    if(canDownload){
+        // 允许下载
+        completionHandler(NSURLSessionResponseAllow);
+    }
+    else{
+        // 不允许下载
+        completionHandler(NSURLSessionResponseCancel);
+    }
+    
+}
+
+// 接受到数据碎片 的时候调用,调用多次
+- (void)URLSession:(NSURLSession *)session
+          dataTask:(NSURLSessionDataTask *)dataTask
+    didReceiveData:(NSData *)data {
+    // 接收到session 下载碎片交个列队管理
+    [self dataTask:dataTask didReceiveData:data];
+}
+
+// <NSURLSessionDataDelegate> 完成下载
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+didCompleteWithError:(nullable NSError *)error {
+    [self task:task didCompleteWithError:error];
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+ needNewBodyStream:(void (^)(NSInputStream * _Nullable bodyStream))completionHandler {
+    
+}
+
+- (void)URLSession:(NSURLSession *)session
+              task:(NSURLSessionTask *)task
+   didSendBodyData:(int64_t)bytesSent
+    totalBytesSent:(int64_t)totalBytesSent
+totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
+    
+}
+
+#pragma mark 处理接收到的数据
+
+// 接收到相应时
+- (BOOL)handleOperateby:(NSURLSessionTask*)dataTask WithResponse:(NSURLResponse *)response {
+    
+    customDownloadOperation *operation = nil;
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if(operationDoing.dataTask == dataTask){
+            operation = operationDoing;
+            break;
+        }
+    }
+    
+    if (!operation) {
+        HLog(@"没找到当前下载任务");
+        operation.downloadState = customDownloadStateFailed;
+        [dataTask cancel];
+        return NO;
+    }
+    
+    // 检查response是否是NSHTTPURLResponse的实例
+    if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
+        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
+        NSInteger statusCode = httpResponse.statusCode;
+        HLog(@"HTTP Status Code: %ld", (long)statusCode);
+          
+        if(statusCode == 404){
+            operation.downloadState = customDownloadStateFailed;
+            operation.isFile404Cancel = YES;
+            return NO;
+        }
+        
+    }
+    
+    // 总的size
+    if (operation.currentSize + response.expectedContentLength == 0) {
+        HLog(@"下载数据回调异常");
+        operation.downloadState = customDownloadStateFailed;
+        return NO;
+    }
+    operation.totalSize = operation.currentSize + response.expectedContentLength;
+    
+    // 创建空的文件夹
+    if (operation.currentSize == 0) {
+        // 创建空的文件
+        [[NSFileManager defaultManager]  createFileAtPath:operation.fullPath contents:nil attributes:nil];
+    }
+    
+    // 创建文件句柄
+    operation.handle = [NSFileHandle fileHandleForWritingAtPath:operation.fullPath];
+    
+    // 文件句柄移动到文件末尾 位置 // 返回值是 unsign long long
+    [operation.handle seekToEndOfFile];
+    
+    // 开始下载记录文件下载信息
+    operation.downloadState = customDownloadStateDoing;
+    
+    return YES;
+}
+
+- (void)dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
+{
+    customDownloadOperation *operation = nil;
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if(operationDoing.dataTask == dataTask){
+            operation = operationDoing;
+            break;
+        }
+    }
+    
+    if (!operation) {
+        HLog(@"没找到当前下载任务");
+        [dataTask cancel];
+        return;
+    }
+    
+    //手动取消任务
+    if (operation.isManualCancel) {
+        return;
+    }
+    
+    // 获得已经下载的文件大小
+    operation.currentSize += data.length;
+    HLog(@"currentSize:%lld---progress:%.2f", operation.currentSize, 1.00*operation.currentSize/operation.totalSize);
+
+    // 写入文件
+    if(operation.handle){
+        [operation.handle writeData:data];
+    }
+
+    // 下载中通知
+    [self operationDoningWithOperation:operation];
+}
+
+- (void)task:(NSURLSessionTask *)dataTask didCompleteWithError:(NSError *)error
+{
+    customDownloadOperation *operation = nil;
+    for (customDownloadOperation *operationDoing in self.downloadingOperationArr) {
+        if(operationDoing.dataTask == dataTask){
+            operation = operationDoing;
+            [self.downloadingOperationArr removeObject:operationDoing];
+            break;
+        }
+    }
+    
+    if (!operation) {
+        HLog(@"没找到当前下载任务");
+        //[dataTask suspend];
+        return;
+    }
+    
+    if(operation.dataTask){
+        //[operation.dataTask cancel];
+        operation.dataTask = nil;
+        operation.session = nil;
+        
+        if(operation.handle){
+            // 关闭文件句柄
+            [operation.handle closeFile];
+            // 释放文件句柄
+            operation.handle = nil;
+        }
+    }
+    
+    if(error && error.code == -1005 && !operation.isFile404Cancel){//网络中断
+        HLog(@"reDownloadNetworkTaskBy");
+        //延时几秒再次启动这个任务
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            [self reDownloadNetworkTaskBy:operation.url];
+        });
+        return;
+    }
+    
+    if(operation.isManualCancel){
+        [self beginDownload];
+        return;
+    }
+    
+    // 完成下载 通知 block
+    if (error ||operation.downloadState == customDownloadStateFailed) {
+        [self operationFailedWithOperation:operation];
+    } else {
+        operation.isFinished = YES;
+        operation.timeStamp = [iTools getNowTimeStamp];
+        [self operationSuccessWithOperation:operation];
+    }
+    
+    [self beginDownload];
+}
+
+
+#pragma mark 发送通知
+
+// 失败某一个operation 保存本地 通知外界
+- (void)operationFailedWithOperation:(customDownloadOperation *)operation {
+    HLog(@"audio DownloadTaskExeError \n %@",operation.url);
+    operation.downloadState = customDownloadStateFailed;
+    //[[NSNotificationCenter defaultCenter] postNotificationName:customDownloadTaskExeError object:nil userInfo:@{@"operation" : operation}];
+}
+
+//外面的下载数据跳的太频繁 控制下
+//static int DownloadTaskExeingNotNum = 0;
+
+// 重启某一个operation 保存本地 通知外界
+- (void)operationDoningWithOperation:(customDownloadOperation *)operation {
+    HLog(@"audio DownloadTaskExeing");
+    
+//    DownloadTaskExeingNotNum ++;
+//    if (DownloadTaskExeingNotNum >= 10) {
+//        DownloadTaskExeingNotNum = 0;
+//        [[NSNotificationCenter defaultCenter] postNotificationName:customDownloadTaskExeing object:nil userInfo:@{@"operation" : operation}];
+//    }
+}
+
+// 等待某一个operation 保存本地 通知外界
+- (void)operationSuccessWithOperation:(customDownloadOperation *)operation {
+    HLog(@"audio DownloadTaskExeEnd \n %@",operation.url);
+    
+    //更新歌曲播放列表
+    [[audioPlayListManager shareManager] changeFileToDonewith:operation.url];
+    
+    operation.downloadState = customDownloadStateCompleted;
+    
+}
+
+-(NSURLSession*)creatNewSessionFun
+{
+    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
+    // 设置请求超时
+    config.timeoutIntervalForRequest = -1;
+//        config.networkServiceType = NSURLNetworkServiceTypeVideo;
+    config.timeoutIntervalForResource = -1;
+//        config.TLSMaximumSupportedProtocol = kSSLProtocolAll;
+    
+    //_session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue currentQueue]];
+    NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil];
+    
+    return session;
+}
+
+#pragma mark - lazy load
+- (NSMutableArray *)downloadWaitingUrlArr {
+    
+    if (!_downloadWaitingUrlArr) {
+        _downloadWaitingUrlArr = [NSMutableArray array];
+    }
+    return _downloadWaitingUrlArr;
+}
+
+- (NSMutableArray *)downloadingOperationArr {
+    
+    if (!_downloadingOperationArr) {
+        _downloadingOperationArr = [NSMutableArray array];
+    }
+    return _downloadingOperationArr;
+}
+
+- (BOOL)isDownLoadIngType
+{
+    if(self.downloadingOperationArr.count >= 1){
+        return YES;
+    }
+    
+    return NO;
+}
+@end

+ 12 - 0
创维盒子/双子星云手机/NAS/recenFile/audioPlayListManager.h

@@ -7,6 +7,7 @@
 
 #import <Foundation/Foundation.h>
 #import "lastFileModel.h"
+#import "audioPlayDownloadManager.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -26,6 +27,17 @@ NS_ASSUME_NONNULL_BEGIN
 - (BOOL)saveFileInfoWith:(lastFileModel *)lastFileMod with:(NSString*)fullPath;
 /**  删除配置信息 */
 - (BOOL)deleteFileInfoWithUrl:(NSString *)fullPath;
+
+- (NSString*)getAudioCacheFullPathBy:(NSString*)name;
+
+//df准备播放是下载
+- (void)beginToDownloadByUrl:(NSString*)url;
+
+/**  更新下载完成 */
+- (void)changeFileToDonewith:(NSString*)url;
+
+/**  检测是否下载完成 */
+- (NSString*)checkFileToDownloadDonewith:(NSString*)url;
 @end
 
 NS_ASSUME_NONNULL_END

+ 131 - 1
创维盒子/双子星云手机/NAS/recenFile/audioPlayListManager.m

@@ -104,7 +104,7 @@
     
     BOOL flag = NO;
     @synchronized (self) {
-        NSString *key = fullPath;
+        //NSString *key = fullPath;
         //1.本地持久化
         NSMutableDictionary *dictM =  self.audioPlayPList;
         NSMutableArray *dataArr = self.audioPlayListArr;
@@ -119,6 +119,7 @@
                 break;
             }
             
+            model.localPath = [self getAudioCacheFullPathBy:model.name];
             NSDictionary *dict = [model lastFileInfoFun];
             [saveDictArr addObject:dict];
         }
@@ -179,4 +180,133 @@
     return flag;
 }
 
+- (NSString*)getAudioCacheFullPathBy:(NSString*)name
+{
+    NSString*fullPathDirector = [NSString stringWithFormat:@"%@/%@",DocumentPath,@"playAudioCache"];
+    
+    // 创建文件储存路径
+    if (![[NSFileManager defaultManager] fileExistsAtPath:fullPathDirector]) {
+        [[NSFileManager defaultManager] createDirectoryAtPath:fullPathDirector withIntermediateDirectories:YES attributes:nil error:nil];
+    }
+    NSString*fullPath = [NSString stringWithFormat:@"%@/%@",fullPathDirector,name];
+    return fullPath;
+}
+
+//df准备播放是下载
+- (void)beginToDownloadByUrl:(NSString*)url
+{
+    if(!url)return;
+    
+    //解码
+    //NSString * urlString = [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    
+    NSString *urlFileName = [url lastPathComponent];
+    
+    NSString *filePath = [iTools base64UrlDecoder:urlFileName];
+    //NSString * fileName = [filePath lastPathComponent];
+    
+    NSString *urlStr = ksharedAppDelegate.NASFileByBoxService;
+//    NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles/%@",urlStr,urlFileName];
+
+    NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",urlStr,filePath];
+    fileUrl = [fileUrl  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    
+    if (![self checkDownloadDoneBy:filePath]) {
+        [[audioPlayDownloadManager shareManager] addDownloadWithURLs:@[fileUrl]];
+    }
+}
+
+//检测是否下载完成
+- (BOOL)checkDownloadDoneBy:(NSString*)filePath
+{
+    lastFileModel*preDownloadModel = nil;
+    for (lastFileModel*model in self.audioPlayListArr) {
+        if([model.path isEqualToString:filePath]){
+            preDownloadModel = model;
+            break;
+        }
+    }
+    
+    if(preDownloadModel && preDownloadModel.isDownDoneType){
+        return YES;
+    }
+    
+    return NO;
+}
+
+/**  更新下载完成 */
+- (void)changeFileToDonewith:(NSString*)url
+{
+    NSString * decodeUrl= [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    
+    NSArray *urlArr = [decodeUrl componentsSeparatedByString:@"?path="];
+    if(urlArr.count >= 2){
+        NSString *filePath = urlArr.lastObject;
+        
+        for (lastFileModel*model in self.audioPlayListArr) {
+            if([model.path isEqualToString:filePath]){
+                model.isDownDoneType = YES;
+                [self updateLoaclInfoFun];
+                break;
+            }
+        }
+    }
+}
+
+//本地更新数据持久化
+- (void)updateLoaclInfoFun
+{
+    @synchronized (self) {
+    
+        //1.本地持久化
+        NSMutableDictionary *dictM =  self.audioPlayPList;
+        NSMutableArray *dataArr = self.audioPlayListArr;
+        
+        NSMutableArray *saveDictArr = [NSMutableArray new];
+        for (lastFileModel*model in dataArr) {
+            model.localPath = [self getAudioCacheFullPathBy:model.name];
+            NSDictionary *dict = [model lastFileInfoFun];
+            [saveDictArr addObject:dict];
+        }
+        
+        //2.本地持久化
+        if(saveDictArr){
+            [dictM setValue:saveDictArr forKey:KaudioPlayListkey];
+        }
+        
+        NSString * PlistPath = [self getAudioPlayListPlistPath];
+        [dictM writeToFile:PlistPath atomically:YES];
+    }
+}
+
+/**  检测是否下载完成 */
+- (NSString*)checkFileToDownloadDonewith:(NSString*)url
+{
+    NSString *urlFileName = [url lastPathComponent];
+    NSString *filePath = [iTools base64UrlDecoder:urlFileName];
+    
+    for (lastFileModel*model in self.audioPlayListArr) {
+        if([model.path isEqualToString:filePath]){
+            if (model.isDownDoneType) {
+                if(model.localPath){
+                    // 创建NSFileManager实例
+                    NSFileManager *fileManager = [NSFileManager defaultManager];
+              
+                    // 使用fileExistsAtPath方法检查文件是否存在
+                    BOOL fileExists = [fileManager fileExistsAtPath:model.localPath];
+              
+                    if (fileExists) {
+                        return  model.localPath;
+                    } else {
+                        return @"";
+                    }
+                }
+            }
+            
+            break;
+        }
+    }
+    
+    return @"";
+}
 @end

+ 2 - 0
创维盒子/双子星云手机/NAS/recenFile/lastFileModel.h

@@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) NSTimeInterval lastPreTime;//最后预览时间
 
+@property (nonatomic, assign) BOOL  isDownDoneType;//下载完成
+@property (nonatomic, copy) NSString*localPath;//本地缓存路径
 
 - (NSDictionary *)lastFileInfoFun;
 @end

+ 18 - 0
创维盒子/双子星云手机/NAS/recenFile/lastFileModel.m

@@ -12,6 +12,22 @@
 #pragma mark - get lastFile info
 //
 - (NSDictionary *)lastFileInfoFun{
+    
+    if(self.localPath){
+        return  @{
+                   @"path" : self.path,
+                   @"name" : self.name,
+                   @"time" : self.time,
+                   @"type" : self.type,
+                   @"size" : @(self.size),
+                  @"duration" : @(self.duration),
+                   //@"isSelectType" : @(self.isSelectType),
+                  @"lastPreTime" : @(self.lastPreTime),
+                   @"isDownDoneType" : @(self.isDownDoneType),
+                   @"localPath" : self.localPath,
+                };
+    }
+    
     return  @{
                @"path" : self.path,
                @"name" : self.name,
@@ -21,6 +37,8 @@
               @"duration" : @(self.duration),
                //@"isSelectType" : @(self.isSelectType),
               @"lastPreTime" : @(self.lastPreTime),
+               @"isDownDoneType" : @(self.isDownDoneType),
+               //@"localPath" : self.localPath,
             };
 }
 @end

+ 20 - 0
创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayer.m

@@ -12,6 +12,9 @@
 #import "DFPlayerTool.h"
 #import <MediaPlayer/MediaPlayer.h>
 
+//hxd add 20240716
+#import "audioPlayListManager.h"
+
 /**Asset KEY*/
 NSString * const DFPlayableKey                  = @"playable";
 /**PlayerItem KEY*/
@@ -308,6 +311,9 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
         return;
     }
 
+    //hxd add 20240716 去下载 自己管理缓存
+    [[audioPlayListManager shareManager] beginToDownloadByUrl:self.currentAudioModel.audioUrl.absoluteString];
+    
     if (self.dataSource && [self.dataSource respondsToSelector:@selector(df_audioInfoForPlayer:)]) {
         self.currentAudioInfoModel = [self.dataSource df_audioInfoForPlayer:self];
     }
@@ -316,6 +322,20 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
         [self.delegate df_playerAudioAddToPlayQueue:self];
     }
 
+    //hxd add 20240716 判断下载完成了没有 完成了 就修改 audioUrl
+    if ([DFPlayerTool isLocalAudio:self.currentAudioModel.audioUrl]){
+        
+        NSString*filePath = [[audioPlayListManager shareManager] checkFileToDownloadDonewith:self.currentAudioModel.audioUrl.absoluteString];
+        
+        if(filePath.length > 0)
+        {
+            NSURL *loaclUrl = [NSURL fileURLWithPath:filePath];
+            if(loaclUrl){
+                self.currentAudioModel.audioUrl = loaclUrl;
+            }
+        }
+    }
+    
     if ([DFPlayerTool isLocalAudio:self.currentAudioModel.audioUrl]) {
 //        NSLog(@"-- DFPlayer:本地音频,Id:%ld",(unsigned long)self.currentAudioModel.audioId);
         _isCached = YES;