Browse Source

1.音频没缓存问题

huangxiaodong 1 year ago
parent
commit
5663919c20

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

@@ -839,7 +839,7 @@
     //尝试强行修改 歌曲名 后续有时间优化
     _lastAudioIndex = player.currentAudioModel.audioId;
     _index = _lastAudioIndex;
-    HLog(@"df_player progress hxd  _ind:setTitleFunByIndex");
+    //HLog(@"df_player progress hxd  _ind:setTitleFunByIndex");
     [self setTitleFunByIndex];
     
     if(progress >= 1.0){
@@ -883,7 +883,7 @@
 
 -(void)setTitleFunByIndex
 {
-    HLog(@"setTitleFunByIndex")
+    //HLog(@"setTitleFunByIndex")
     if(!_allAudioDataArray){
         KWeakSelf
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -901,7 +901,7 @@
             _audioPlayListV.playingIndex = _index;
         }
 
-        HLog(@"hxd  _index:%ld  name:%@",_index,dataModel.name)
+        //HLog(@"hxd  _index:%ld  name:%@",_index,dataModel.name)
     }
 }
 

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

@@ -248,7 +248,13 @@
         }
     }
     
-    if(preDownloadModel && preDownloadModel.isDownDoneType){
+    // 创建NSFileManager实例
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    // 使用fileExistsAtPath方法检查文件是否存在
+    BOOL fileExists = [fileManager fileExistsAtPath:preDownloadModel.localPath];
+    
+    
+    if(preDownloadModel && preDownloadModel.isDownDoneType && fileExists){
         return YES;
     }
     

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

@@ -329,14 +329,8 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
         return;
     }
 
-    //hxd add 20240716 去下载 自己管理缓存
-    if(!self.currentAudioModel.didCacheWorkType){
-        [[audioPlayListManager shareManager] beginToDownloadByUrl:self.currentAudioModel.audioUrl.absoluteString];
-        
-        self.currentAudioModel.didCacheWorkType = YES;
-    }
-    
-    //[[audioPlayListManager shareManager] beginToDownloadByUrl:self.currentAudioModel.audioUrl.absoluteString];
+    //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];

+ 1 - 1
创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayerModel.h

@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) NSURL *audioUrl; // 音频地址
 
 //hxd add 20240726
-@property (nonatomic, assign) BOOL didCacheWorkType;//是否做了缓存
+//@property (nonatomic, assign) BOOL didCacheWorkType;//是否做了缓存
 @end
 
 /**