浏览代码

1.音频播放器---改造中

huangxiaodong 11 月之前
父节点
当前提交
ba4523cc58
共有 17 个文件被更改,包括 265 次插入283 次删除
  1. 12 0
      创维盒子/双子星云手机.xcodeproj/project.pbxproj
  2. 1 1
      创维盒子/双子星云手机/Class/Set/previewFile/addAudioToPlayListViewController.h
  3. 30 170
      创维盒子/双子星云手机/Class/Set/previewFile/addAudioToPlayListViewController.m
  4. 3 4
      创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.h
  5. 74 60
      创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.m
  6. 3 3
      创维盒子/双子星云手机/Class/Set/previewFile/previewAudioOrDocumentViewController.m
  7. 4 4
      创维盒子/双子星云手机/Class/Set/previewFile/previewFileAndFolderSecondViewController.m
  8. 5 5
      创维盒子/双子星云手机/Class/Set/previewFile/previewFileAndFolderViewController.m
  9. 17 0
      创维盒子/双子星云手机/Class/Set/previewFile/view/addAudioToPlayListBottomView.h
  10. 71 0
      创维盒子/双子星云手机/Class/Set/previewFile/view/addAudioToPlayListBottomView.m
  11. 1 0
      创维盒子/双子星云手机/Class/Set/previewFile/view/audioPlayListView.h
  12. 6 0
      创维盒子/双子星云手机/Class/Set/previewFile/view/audioPlayListView.m
  13. 17 17
      创维盒子/双子星云手机/NAS/NASViewController.m
  14. 1 1
      创维盒子/双子星云手机/NAS/NasPreviewVideoViewController.m
  15. 16 16
      创维盒子/双子星云手机/NAS/nasLastFileViewController.m
  16. 3 0
      创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayer.h
  17. 1 2
      创维盒子/双子星云手机/Vendor/DFPlayer/DFPlayer.m

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

@@ -1190,6 +1190,10 @@
 		6BF558D22C45442100701854 /* addAudioToPlayListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF558CF2C45442100701854 /* addAudioToPlayListViewController.h */; };
 		6BF558D32C45442100701854 /* addAudioToPlayListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF558D02C45442100701854 /* addAudioToPlayListViewController.m */; };
 		6BF558D42C45442100701854 /* addAudioToPlayListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF558CF2C45442100701854 /* addAudioToPlayListViewController.h */; };
+		6BF558D72C45488A00701854 /* addAudioToPlayListBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF558D62C45488A00701854 /* addAudioToPlayListBottomView.m */; };
+		6BF558D82C45488A00701854 /* addAudioToPlayListBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF558D52C45488A00701854 /* addAudioToPlayListBottomView.h */; };
+		6BF558D92C45488A00701854 /* addAudioToPlayListBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF558D62C45488A00701854 /* addAudioToPlayListBottomView.m */; };
+		6BF558DA2C45488A00701854 /* addAudioToPlayListBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BF558D52C45488A00701854 /* addAudioToPlayListBottomView.h */; };
 		6BFF26882AF8949F00FCB4F7 /* playerShowSecretkeyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BFF26862AF8949F00FCB4F7 /* playerShowSecretkeyView.h */; };
 		6BFF26892AF8949F00FCB4F7 /* playerShowSecretkeyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BFF26872AF8949F00FCB4F7 /* playerShowSecretkeyView.m */; };
 		6BFF268C2AF8E1C600FCB4F7 /* forgetPwdViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BFF268A2AF8E1C600FCB4F7 /* forgetPwdViewController.h */; };
@@ -1928,6 +1932,8 @@
 		6BF558CA2C45394F00701854 /* audioPlayListViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = audioPlayListViewCell.m; sourceTree = "<group>"; };
 		6BF558CF2C45442100701854 /* addAudioToPlayListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = addAudioToPlayListViewController.h; sourceTree = "<group>"; };
 		6BF558D02C45442100701854 /* addAudioToPlayListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = addAudioToPlayListViewController.m; sourceTree = "<group>"; };
+		6BF558D52C45488A00701854 /* addAudioToPlayListBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = addAudioToPlayListBottomView.h; sourceTree = "<group>"; };
+		6BF558D62C45488A00701854 /* addAudioToPlayListBottomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = addAudioToPlayListBottomView.m; sourceTree = "<group>"; };
 		6BFF26862AF8949F00FCB4F7 /* playerShowSecretkeyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = playerShowSecretkeyView.h; sourceTree = "<group>"; };
 		6BFF26872AF8949F00FCB4F7 /* playerShowSecretkeyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = playerShowSecretkeyView.m; sourceTree = "<group>"; };
 		6BFF268A2AF8E1C600FCB4F7 /* forgetPwdViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = forgetPwdViewController.h; sourceTree = "<group>"; };
@@ -2842,6 +2848,8 @@
 				6BF558C42C45247E00701854 /* audioPlayListView.m */,
 				6BF558C92C45394F00701854 /* audioPlayListViewCell.h */,
 				6BF558CA2C45394F00701854 /* audioPlayListViewCell.m */,
+				6BF558D52C45488A00701854 /* addAudioToPlayListBottomView.h */,
+				6BF558D62C45488A00701854 /* addAudioToPlayListBottomView.m */,
 			);
 			path = view;
 			sourceTree = "<group>";
@@ -3738,6 +3746,7 @@
 				6B1FBD3A2B467A8000926382 /* backupsFilerecordTableView.h in Headers */,
 				6B7DDF262C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.h in Headers */,
 				6B2C1E782C070ADE00FDCF82 /* ZFLandscapeWindow.h in Headers */,
+				6BF558D82C45488A00701854 /* addAudioToPlayListBottomView.h in Headers */,
 				6BF0F3D02AD391D8000AA133 /* connectDeviceManager.h in Headers */,
 				6B2C1E982C070ADE00FDCF82 /* ZFPlayerNotification.h in Headers */,
 				6B7EA7A42BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */,
@@ -3995,6 +4004,7 @@
 				6BD506C02B9576A4006E7CB0 /* backupsFilerecordTableView.h in Headers */,
 				6B7DDF282C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.h in Headers */,
 				6B2C1E792C070ADE00FDCF82 /* ZFLandscapeWindow.h in Headers */,
+				6BF558DA2C45488A00701854 /* addAudioToPlayListBottomView.h in Headers */,
 				6BD506C12B9576A4006E7CB0 /* connectDeviceManager.h in Headers */,
 				6B2C1E992C070ADE00FDCF82 /* ZFPlayerNotification.h in Headers */,
 				6B7EA7A62BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */,
@@ -4587,6 +4597,7 @@
 				6BD507242B9576A4006E7CB0 /* filePathCreatPopView.m in Sources */,
 				6B9354AF2BF3879200AA8D31 /* shareRecordTableViewCell.m in Sources */,
 				6BD507252B9576A4006E7CB0 /* inputPWDViewController.m in Sources */,
+				6BF558D92C45488A00701854 /* addAudioToPlayListBottomView.m in Sources */,
 				6BD507262B9576A4006E7CB0 /* UIColor+Colors.m in Sources */,
 				6B6ABEE92BFF49C800480BAC /* receiveDownloadRecordTableView.m in Sources */,
 				6BD507272B9576A4006E7CB0 /* AJPhotoListView.m in Sources */,
@@ -4926,6 +4937,7 @@
 				6B5B60772B3E665E009A2AE2 /* filePathCreatPopView.m in Sources */,
 				6B9354AC2BF3879200AA8D31 /* shareRecordTableViewCell.m in Sources */,
 				6BF52CA22AD7C2F600A617DB /* inputPWDViewController.m in Sources */,
+				6BF558D72C45488A00701854 /* addAudioToPlayListBottomView.m in Sources */,
 				A003F6B627D841EE00715CBF /* UIColor+Colors.m in Sources */,
 				6B6ABEE72BFF49C800480BAC /* receiveDownloadRecordTableView.m in Sources */,
 				6B05819E2AFCF4E800D37290 /* AJPhotoListView.m in Sources */,

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/addAudioToPlayListViewController.h

@@ -10,7 +10,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface addAudioToPlayListViewController : BaseViewController
-
+@property (nonatomic,copy) void (^didNeedToRegetAudioPlayListFun)(void);
 @end
 
 NS_ASSUME_NONNULL_END

+ 30 - 170
创维盒子/双子星云手机/Class/Set/previewFile/addAudioToPlayListViewController.m

@@ -16,14 +16,12 @@
 #import "diskListTableView.h"
 #import "downLoadPreViewCell.h"
 #import "editTypeHeadView.h"
-#import "editTypeBottomView.h"
+#import "addAudioToPlayListBottomView.h"
 #import "editShareView.h"
 #import "previewToUploadFileView.h"
 #import "netWorkManager.h"
 #import "NASFileAudioModel.h"
-#import "queryShareModel.h"
-#import "audioPlayerViewController.h"
-#import "videoPlayByAVPlayerViewController.h"
+#import "audioPlayListManager.h"
 
 @interface addAudioToPlayListViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 {
@@ -40,7 +38,7 @@
 @property (nonatomic, copy) NSString *defaultDiskPath;
 @property(nonatomic,assign) BOOL isEditType;
 @property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
-@property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
+@property(nonatomic,strong) addAudioToPlayListBottomView*bottomView;
 
 @property (nonatomic, strong)  NSMutableArray*didSelectListArr;//选中的数据
 @property (nonatomic, strong)NASFileAudioModel * curNASFileAudioMod;
@@ -94,28 +92,19 @@
     };
     
     
-    _curEditTypeBottomView = [[editTypeBottomView alloc] init];
-    _curEditTypeBottomView.hidden = YES;
-    [self.view addSubview:_curEditTypeBottomView];
+    _bottomView = [[addAudioToPlayListBottomView alloc] init];
+    [self.view addSubview:_bottomView];
     
-    [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         make.bottom.mas_equalTo(0);
-        make.height.mas_equalTo(60 + AdaptTabHeight);
+        make.height.mas_equalTo(60 + safeArea);
     }];
     
-#pragma mark 编辑状态的 下载 分享 删除 响应事件
-    _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
-        if(tag==1){
-            [weakSelf gotoDownLoadFileFun];
-        }
-        else if(tag==2){
-            [weakSelf gotoShareViewFun];
-        }
-        else if(tag==3){
-            [weakSelf showDeleteAlearViewFun];
-        }
+#pragma mark 编辑状态的 添加播放列表 响应事件
+    _bottomView.didClickButtonFun = ^(NSInteger tag) {
+        [weakSelf addToAudioPlayListFun];
     };
     
     [self.view addSubview:self.tableView];
@@ -123,7 +112,7 @@
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         //make.bottom.mas_equalTo(-(safeArea));
-        make.bottom.mas_equalTo(0);
+        make.bottom.mas_equalTo(_bottomView.mas_top);
         make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
     }];
     
@@ -354,14 +343,7 @@
     //[self.tableView  reloadData];
     
     _curEditTypeHeadView.hidden = NO;
-    _curEditTypeBottomView.hidden = NO;
     
-    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(0);
-        make.right.mas_equalTo(0);
-        make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
-        make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
-    }];
 }
 
 #pragma mark 用户取消编辑编辑
@@ -372,19 +354,12 @@
         model.isSelectType = NO;
     }
     [_didSelectListArr removeAllObjects];
+    [_bottomView setButtonStateFunBy:NO];
     
     _isEditType = NO;
     [self.tableView  reloadData];
     
     _curEditTypeHeadView.hidden = YES;
-    _curEditTypeBottomView.hidden = YES;
-    
-    [self.tableView  mas_remakeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(0);
-        make.right.mas_equalTo(0);
-        make.bottom.mas_equalTo(0);
-        make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
-    }];
 }
 
 - (void)userCheckFilePreviewByRow:(NSInteger)row
@@ -438,46 +413,9 @@
     else{
         [self userCancelEditTypeFun];
     }
-}
-
-#pragma mark 用户点击分享
-- (void)gotoShareViewFun
-{
-    if (_didSelectListArr.count > 5) {
-        [[iToast makeText:NSLocalizedString(@"share_max_count_tip2",nil)] show];
-        return;
-    }
     
-    editShareView *editShareV = [[editShareView alloc] init];
-    editShareV.didSelectListArr = _didSelectListArr;
-    editShareV.shareFileType = @"4";
-    [self.view addSubview:editShareV];
-    
-    [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(0);
-        make.right.mas_equalTo(0);
-        make.bottom.mas_equalTo(0);
-        make.top.mas_equalTo(0);
-    }];
-}
-
-#pragma mark 用户点击上传文件
-- (void)userDidClickUploadViewFun
-{
-    previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
-    [self.view addSubview:previewToUploadFileV];
-    
-    [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(0);
-        make.right.mas_equalTo(0);
-        make.bottom.mas_equalTo(0);
-        make.top.mas_equalTo(0);
-    }];
-    
-    KWeakSelf
-    previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
-        [weakSelf gotoUploadFileFunWith:tag];
-    };
+    BOOL canClick = _didSelectListArr.count >0 ? YES : NO;
+    [_bottomView setButtonStateFunBy:canClick];
 }
 
 #pragma mark 设置标题
@@ -601,9 +539,6 @@
 }
 
 
-
-
-
 - (void)gotoDownloadloadFileRecordFun
 {
     uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
@@ -684,104 +619,29 @@
     }];
 }
 
-#pragma mark 调整文件上传
-- (void)gotoUploadFileFunWith:(NSInteger)tag
+#pragma mark  添加播放列表 响应事件
+- (void)addToAudioPlayListFun
 {
-    
-}
-
-#pragma mark 文件下载
-- (void)gotoDownLoadFileFun
-{
-    if(_didSelectListArr.count == 0){
-        [[iToast makeText:@""] show];
+    if (_didSelectListArr.count == 0) {
         return;
     }
     
-    NSMutableArray *arr = [NSMutableArray new];
-    for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
-        
-        couldPhoneFileModel* fileModel =  [couldPhoneFileModel new];
-        fileModel.fileType = @"audio";
-        fileModel.path = dataModel.path;
-        fileModel.name = dataModel.name;
-        fileModel.length = dataModel.size;
-        fileModel.time = dataModel.duration;
-        
-        [arr addObject:fileModel];
+    for (NASFileAudioDataModel* dataModel in _didSelectListArr) {
+        lastFileModel *lastFileMod = [lastFileModel new];
+        lastFileMod.path = dataModel.path;
+        lastFileMod.name = dataModel.name;
+        lastFileMod.time = dataModel.time;
+        lastFileMod.size = dataModel.size;
+        lastFileMod.duration = dataModel.duration;
+        lastFileMod.type = @"audio";
+        lastFileMod.lastPreTime = [iTools getNowTimeStamp];
+        [[audioPlayListManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];
     }
     
-    uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
-    [self.navigationController pushViewController:vc animated:YES];
-    vc.isDownloadingType = YES;
-    [vc gotoDownloadFile:arr];
-}
-
-#pragma mark 删除图片
-- (void)showDeleteAlearViewFun
-{
-    NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
-    NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
-
-    KWeakSelf
-    ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
-                                                                                      msg:tipStr
-                                                                                 imageStr:nil
-                                                                              cancelTitle:NSLocalizedString(@"other_cancel",nil)
-                                                                                  okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
-                                                                               didClickOk:^{
-        
-        [weakSelf delFileListFun];
-     } didClickCancel:^{
-         
-     }];
-    
-    curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
-     
-     [self presentViewController:curAlretVC animated:YES completion:^{
-         curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
-     }];
-}
-
-
-#pragma mark 删除文件数据
-- (void)delFileListFun
-{
-    NSMutableDictionary*paraDict = [NSMutableDictionary new];
-    
-    NSMutableArray *pathArr = [NSMutableArray new];
-    for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
-        [pathArr addObject:dataModel.path];
+    if(_didNeedToRegetAudioPlayListFun){
+        _didNeedToRegetAudioPlayListFun();
     }
     
-    [paraDict setValue:pathArr forKey:@"path"];
-    
-    [self showNewIndicatorWithCanBack:YES canTouch:NO];
-    
-    //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
-    KWeakSelf //@"delFile"
-    [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id  _Nonnull responseObject) {
-        [weakSelf removeNewIndicator];
-        SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
-        if(model && model.status == 0){
-            [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
-            [weakSelf didDeleteSucFun];
-        }
-        else{
-            
-        }
-    } failure:^(NSError * _Nonnull error) {
-        [weakSelf removeNewIndicator];
-    }];
+    [self.navigationController popViewControllerAnimated:YES];
 }
-
-#pragma  mark 删除成功
-- (void)didDeleteSucFun
-{
-    [_didSelectListArr removeAllObjects];
-    [self setEditTypeTitleFun];
-    
-    [self getFileListFun];
-}
-
 @end

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

@@ -6,13 +6,12 @@
 //
 
 #import "BaseViewController.h"
-
+#import "NASFileAudioModel.h"
 NS_ASSUME_NONNULL_BEGIN
 
 @interface audioPlayerViewController : BaseViewController
-@property (nonatomic, assign) NSInteger index;//当前位置
-@property (nonatomic, strong) NSArray * audioOutSidedataArray;//传入数据 NASFileAudioDataModel
-
+@property (nonatomic, strong) NASFileAudioDataModel *outSideDataModel;
+@property (nonatomic, assign) BOOL isfirstEnterType;//
 @property (nonatomic,copy) void (^didNeedToRegetDataFun)(void);
 @end
 

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

@@ -9,7 +9,6 @@
 #import "DFPlayer.h"
 #import "DFPlayerUIManager.h"
 
-#import "NASFileAudioModel.h"
 #import "lastFileManager.h"
 #import "audioPlayListManager.h"
 #import <QuartzCore/QuartzCore.h>
@@ -36,6 +35,9 @@
 @property (nonatomic, strong)UIButton * playListBtn;//歌单
 @property (nonatomic, strong)UIButton * playModelBtn;//播放模式(单机 随机 循环)
 
+@property (nonatomic, assign) NSInteger index;//当前位置
+@property (nonatomic, strong) NSMutableArray * allAudioDataArray;//所有的 播放数据(NASFileAudioDataModel或者lastFileModel)
+
 @property (nonatomic, strong) NSMutableArray<DFPlayerModel *> *dataArray;
 @property (nonatomic, assign) NSInteger lastAudioIndex;//-1未记录
 
@@ -380,7 +382,7 @@
 {
     editShareView *editShareV = [[editShareView alloc] init];
     
-    NASFileAudioDataModel *dataModel = _audioOutSidedataArray[_index];
+    NASFileAudioDataModel *dataModel = _allAudioDataArray[_index];
     editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[dataModel]];
     editShareV.shareFileType = @"4";
     
@@ -397,7 +399,7 @@
 #pragma mark 用户点击下载
 - (void)gotoDownLoadFileFun
 {
-    NASFileAudioDataModel *dataModel = _audioOutSidedataArray[_index];
+    NASFileAudioDataModel *dataModel = _allAudioDataArray[_index];
     
     couldPhoneFileModel* fileModel =  [couldPhoneFileModel new];
     fileModel.fileType =  @"audio";
@@ -447,7 +449,7 @@
     NSMutableDictionary*paraDict = [NSMutableDictionary new];
     
     NSMutableArray *pathArr = [NSMutableArray new];
-    NASFileAudioDataModel *dataModel = _audioOutSidedataArray[_index];
+    NASFileAudioDataModel *dataModel = _allAudioDataArray[_index];
     [pathArr addObject:dataModel.path];
     
     [paraDict setValue:pathArr forKey:@"path"];
@@ -488,7 +490,7 @@
 - (void)didClickDetailsFun
 {
     NSMutableArray *pathArr = [NSMutableArray new];
-    NASFileAudioDataModel *dataModel = _audioOutSidedataArray[_index];
+    NASFileAudioDataModel *dataModel = _allAudioDataArray[_index];
     
     previewAudioPortraitDetailsView *topDetailsV = [[previewAudioPortraitDetailsView alloc] initWithFrame:CGRectZero withData:dataModel];
     [self.view addSubview:topDetailsV];
@@ -525,79 +527,92 @@
 {
     addAudioToPlayListViewController *vc = [addAudioToPlayListViewController new];
     [self.navigationController pushViewController:vc animated:YES];
+    
+    KWeakSelf
+    vc.didNeedToRegetAudioPlayListFun = ^{
+        [weakSelf.audioPlayListV reGetDataFun];
+        [weakSelf AddNewAudioToListFun];
+    };
+}
+
+#pragma mark 处理本地是否需要添加新加的的音乐
+- (void)AddNewAudioToListFun
+{
+    [[DFPlayer sharedPlayer] df_reloadData];
+    
 }
 
 #pragma mark - DFPLayer dataSource
 - (NSArray<DFPlayerModel *> *)df_audioDataForPlayer:(DFPlayer *)player{
     _dataArray = [NSMutableArray array];
     
-    for (int i = 0; i < _audioOutSidedataArray.count; i++) {
+    _allAudioDataArray = [NSMutableArray array];
+    
+    //首次进来
+    if(_isfirstEnterType){
+        _isfirstEnterType = NO;
         
-        NASFileAudioDataModel *yourModel = _audioOutSidedataArray[i];
+        //把外面传入的音频作为第一次传入
+        NASFileAudioDataModel *yourModel = _outSideDataModel;
         DFPlayerModel *model = [[DFPlayerModel alloc] init];
-        model.audioId = i;//****重要。AudioId从0开始,仅标识当前音频在数组中的位置。
+        model.audioId = 0;//****重要。AudioId从0开始,仅标识当前音频在数组中的位置。
         
         NSString *filePath = yourModel.path;
         NSString *urlStr = ksharedAppDelegate.NASFileByBoxService;
         
         NSString *string = filePath;
         NSString *filePathBase64 = [iTools base64UrlEncoder:string];
-        //        NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
-        //        NSString *filePathBase64 = [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
-        
-        //        NSData *data2 = [[NSData alloc] initWithBase64EncodedString:filePathBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters];
-        //
-        //        NSString *string32 =[[NSString alloc] initWithData:data2 encoding:NSUTF8StringEncoding];
-        //        HLog(@"hxd1111: %@",string32);
         
-        //filePath = [filePath  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-        //NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",urlStr,filePath];
-        //NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles?path=%@",urlStr,filePath];
         NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles/%@",urlStr,filePathBase64];
-        HLog(@"hxd2222:%@",fileUrl);
-        //fileUrl = @"http://transfertest.armclouding.com:10006/getFile?path=/storage/emulated/0/Download/录音大师-2024.05.22-16:57.mp3";
-        
-        //fileUrl = @"http://m10.music.126.net/20240527160012/d3f165dc686ac01afd4497400b2c2c58/ymusic/5353/0f0f/0358/d99739615f8e5153d77042092f07fd77.mp3";
-        //fileUrl = @"https://www.cambridgeenglish.org/images/153149-movers-sample-listening-test-vol2.mp3";
-        //fileUrl = @"https://www.cambridgeenglish.org/images/506891-a2-key-for-schools-listening-sample-test.mp3";
-        //fileUrl = @"http://downsc.chinaz.net/Files/DownLoad/sound1/201906/11582.mp3";
-        //fileUrl = @"http://downsc.chinaz.net/files/download/sound1/201206/1638.mp3";
-        //fileUrl =@"http://192.168.11.248:9888/getFile?path=/storage/C47D-46D2/audioTest/jiajiaeeyinyue.mp3";
-        //fileUrl =@"http://transfertest.armclouding.com:21025/getFiles/L3N0b3JhZ2UvZW11bGF0ZWQvMC9NdXNpYy9hYmMubXAz";
-        
-        //fileUrl = @"http://downsc.chinaz.net/files/download/sound1/201206/1638.mp3";
-        //fileUrl = @"http://transfertest.armclouding.com:21025/test/abc/abc.mp3";
-        //fileUrl = @"http://transfertest.armclouding.com:21025/test/abc/obj.mp3"; //0603 16:40验证可以播放
-        //fileUrl =  @"http://file.phone.androidscloud.com:8210/document/newFile/download/1/ikIm5C0KjKNvusTF6tIH/LowLevelMultipartUpload_44933618366140107699/1.mp3";
-        
-        //        fileUrl = @"http://transfertest.armclouding.com:10001/getFile?path=/storage/6C07-E638/miniType/%E9%9F%B3%E9%A2%91%E6%A0%BC%E5%BC%8Fing/jiajiaeeyinyue.mp3";
-        
-        //fileUrl = @"http://transfertest.armclouding.com:21025/getFiles/L3N0b3JhZ2UvZW11bGF0ZWQvMC9NdXNpYy9vYmoubXAz";
-        //fileUrl = @"http://transfertest.armclouding.com:21025/getFiles/L3NkY2FyZC9NdXNpYy9vYmoubXAz";
-        
-        //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/25883214_yinyue.wma";//不支持此媒体的格式
-        //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/ffgfge.m4a";//可以播放
-        //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/j14_yinyue.ogg";//不支持此媒体的格式
-        
-        //        fileUrl  = [fileUrl stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-        
+       
         NSURL * curURL =  [NSURL fileURLWithPath:fileUrl];
-        HLog(@"%@",curURL.absoluteString);
         model.audioUrl = curURL;
-        
-        //        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];
-        //            }
-        //        }
+        HLog(@"%@",curURL.absoluteString);
         [_dataArray addObject:model];
+        
+        [_allAudioDataArray addObject:yourModel];
     }
+    
+    //把播放列表的数据同步进来
+    NSMutableArray *localList = [audioPlayListManager shareManager].audioPlayListArr;
+    
+    if(localList.count > 0){
+        NSInteger curIndex = _dataArray.count;
+        for (NSInteger i = 0; i < localList.count; i++)
+        {
+            NASFileAudioDataModel *yourModel = localList[i];
+            DFPlayerModel *model = [[DFPlayerModel alloc] init];
+            model.audioId = i + curIndex;//****重要。AudioId从0开始,仅标识当前音频在数组中的位置。
+            
+            NSString *filePath = yourModel.path;
+            NSString *urlStr = ksharedAppDelegate.NASFileByBoxService;
+            
+            NSString *string = filePath;
+            NSString *filePathBase64 = [iTools base64UrlEncoder:string];
+            
+            NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles/%@",urlStr,filePathBase64];
+           
+            NSURL * curURL =  [NSURL fileURLWithPath:fileUrl];
+            model.audioUrl = curURL;
+            HLog(@"%@",curURL.absoluteString);
+            [_dataArray addObject:model];
+            
+            [_allAudioDataArray addObject:yourModel];
+        }
+    }
+    
     HLog(@"%@ --- %ld",_dataArray,_dataArray.count);
     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{
     
@@ -680,7 +695,6 @@
     [self setTitleFunByIndex];
     [[DFPlayer sharedPlayer] df_reloadData];//需在传入数据源后调用
     
-    [DFPlayer sharedPlayer].playMode = DFPlayerModeOrderCycle;
     
     KWeakSelf
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -697,8 +711,8 @@
 
 -(void)setTitleFunByIndex
 {
-    if(_index < _audioOutSidedataArray.count){
-        NASFileAudioDataModel* dataModel = _audioOutSidedataArray[_index];
+    if(_index < _allAudioDataArray.count){
+        NASFileAudioDataModel* dataModel = _allAudioDataArray[_index];
         //self.titleLabel.text = dataModel.name;
         _AudioTitleLab.text = dataModel.name;
         
@@ -718,8 +732,8 @@
 
 #pragma mark 音频可以播放
 - (void)audioPlayerByIndex:(NSInteger)index{
-    if(index >=0 &&  index < _audioOutSidedataArray.count){
-        NASFileAudioDataModel *dataModel = _audioOutSidedataArray[index];
+    if(index >=0 &&  index < _allAudioDataArray.count){
+        NASFileAudioDataModel *dataModel = _allAudioDataArray[index];
         
         lastFileModel *lastFileMod = [lastFileModel new];
         lastFileMod.path = dataModel.path;

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

@@ -383,10 +383,10 @@
 //        vc.VideoDataMode = VideoDataMode;
 //        [self.navigationController pushViewController:vc animated:YES];
         
-        
+        NASFileAudioDataModel*dataModel =  _curNASFileAudioMod.data.list[row];
         audioPlayerViewController * vc = [audioPlayerViewController new];
-        vc.index = row;
-        vc.audioOutSidedataArray = _curNASFileAudioMod.data.list;
+        vc.isfirstEnterType = YES;
+        vc.outSideDataModel = dataModel;
         [self.navigationController pushViewController:vc animated:YES];
         
         KWeakSelf

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

@@ -268,12 +268,12 @@
         }
         else if([dataModel.type isEqualToString:@"audio"]){
             
-            NSMutableArray *dataArr = [NSMutableArray new];
-            [dataArr addObject:dataModel];
+//            NSMutableArray *dataArr = [NSMutableArray new];
+//            [dataArr addObject:dataModel];
             
             audioPlayerViewController *vc = [audioPlayerViewController new];
-            vc.index = 0;
-            vc.audioOutSidedataArray = dataArr;
+            vc.isfirstEnterType = YES;
+            vc.outSideDataModel = (NASFileAudioDataModel *)dataModel;
             [self.navigationController pushViewController:vc animated:YES];
             
             KWeakSelf

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

@@ -395,12 +395,12 @@
         }
         else if([dataModel.type isEqualToString:@"audio"]){
             
-            NSMutableArray *dataArr = [NSMutableArray new];
-            [dataArr addObject:dataModel];
+//            NSMutableArray *dataArr = [NSMutableArray new];
+//            [dataArr addObject:dataModel];
             
-            audioPlayerViewController *vc = [audioPlayerViewController new];
-            vc.index = 0;
-            vc.audioOutSidedataArray = dataArr;
+            audioPlayerViewController * vc = [audioPlayerViewController new];
+            vc.isfirstEnterType = YES;
+            vc.outSideDataModel = (NASFileAudioDataModel *)dataModel;
             [self.navigationController pushViewController:vc animated:YES];
             
             KWeakSelf

+ 17 - 0
创维盒子/双子星云手机/Class/Set/previewFile/view/addAudioToPlayListBottomView.h

@@ -0,0 +1,17 @@
+//
+//  addAudioToPlayListBottomView.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/15.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface addAudioToPlayListBottomView : UIView
+@property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
+- (void)setButtonStateFunBy:(BOOL)canClick;
+@end
+
+NS_ASSUME_NONNULL_END

+ 71 - 0
创维盒子/双子星云手机/Class/Set/previewFile/view/addAudioToPlayListBottomView.m

@@ -0,0 +1,71 @@
+//
+//  addAudioToPlayListBottomView.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/15.
+//
+
+#import "addAudioToPlayListBottomView.h"
+
+@interface addAudioToPlayListBottomView ()
+@property(nonatomic,strong) UIButton*bottomButton;
+@end
+
+@implementation addAudioToPlayListBottomView
+
+- (id)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    self.backgroundColor = [UIColor whiteColor];
+    [self drawAnyView];
+    return self;
+}
+
+- (void)drawAnyView{
+    
+    // gradient
+    CAGradientLayer *gl = [CAGradientLayer layer];
+    gl.frame = CGRectMake(0,0,SCREEN_W,40.f);
+    gl.startPoint = CGPointMake(0, 0.5);
+    gl.endPoint = CGPointMake(1, 0.5);
+    gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
+    gl.locations = @[@(0), @(1.0f)];
+    
+    _bottomButton = [[UIButton alloc] init];
+    [_bottomButton.layer addSublayer:gl];
+    
+    [_bottomButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
+    [_bottomButton setTitle:NSLocalizedString(@"NAS_add_audio_to_play_list",nil) forState:UIControlStateNormal];
+    [_bottomButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+    _bottomButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
+    _bottomButton.layer.cornerRadius = 8;
+    _bottomButton.layer.masksToBounds = YES;
+    [self addSubview:_bottomButton];
+    [self setButtonStateFunBy:NO];
+    
+    [_bottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-15);
+        make.left.mas_equalTo(15);
+        make.height.mas_equalTo(40);
+        make.top.mas_equalTo(10);
+    }];
+}
+
+- (void)didClickButFun:(UIButton*)but
+{
+    NSInteger tag = but.tag;
+    
+    if(_didClickButtonFun){
+        _didClickButtonFun(tag);
+    }
+}
+
+
+- (void)setButtonStateFunBy:(BOOL)canClick
+{
+    CGFloat alpha = canClick ? 1.0 : 0.5;
+    _bottomButton.enabled = canClick;
+    
+    _bottomButton.alpha = alpha;
+}
+
+@end

+ 1 - 0
创维盒子/双子星云手机/Class/Set/previewFile/view/audioPlayListView.h

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic,copy) void (^didClickButtonFun)(void);
 
 - (id)initWithFrame:(CGRect)frame withIndex:(NSInteger)index;
+- (void)reGetDataFun;
 @end
 
 NS_ASSUME_NONNULL_END

+ 6 - 0
创维盒子/双子星云手机/Class/Set/previewFile/view/audioPlayListView.m

@@ -239,5 +239,11 @@
 {
     [self removeFromSuperview];
 }
+
+#pragma mark 重新获取数据
+- (void)reGetDataFun
+{
+    [self setTitleStrFun];
+}
 @end
 

+ 17 - 17
创维盒子/双子星云手机/NAS/NASViewController.m

@@ -330,24 +330,24 @@
         }
         else if([dataModel.type isEqualToString:@"audio"]){
             
-            NSMutableArray *audioDataArr = [NSMutableArray new];
-            NSInteger index = 0;
-            
-            for (int i=0; i<_lastFileDataArr.count; i++) {
-                lastFileModel* audioDataModel = _lastFileDataArr[i];
-                if([audioDataModel.type isEqualToString:@"audio"]){
-                    
-                    if(i == row){
-                        index = audioDataArr.count;
-                    }
-                    
-                    [audioDataArr addObject:audioDataModel];
-                }
-            }
+//            NSMutableArray *audioDataArr = [NSMutableArray new];
+//            NSInteger index = 0;
+//            
+//            for (int i=0; i<_lastFileDataArr.count; i++) {
+//                lastFileModel* audioDataModel = _lastFileDataArr[i];
+//                if([audioDataModel.type isEqualToString:@"audio"]){
+//                    
+//                    if(i == row){
+//                        index = audioDataArr.count;
+//                    }
+//                    
+//                    [audioDataArr addObject:audioDataModel];
+//                }
+//            }
             
             audioPlayerViewController *vc = [audioPlayerViewController new];
-            vc.index = index;
-            vc.audioOutSidedataArray = audioDataArr;
+            vc.isfirstEnterType = YES;
+            vc.outSideDataModel = (NASFileAudioDataModel *)dataModel;
             [self.navigationController pushViewController:vc animated:YES];
             
             KWeakSelf
@@ -665,7 +665,7 @@
     
     [paraDict setValue:@7 forKey:@"type"];
     
-    KWeakSelf
+    //KWeakSelf
     [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id  _Nonnull responseObject){
         queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
         if(queryShareMod){

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

@@ -22,7 +22,7 @@
 #import "netWorkManager.h"
 #import "NASFileAudioModel.h"
 #import "queryShareModel.h"
-#import "audioPlayerViewController.h"
+//#import "audioPlayerViewController.h"
 #import "videoPlayByAVPlayerViewController.h"
 
 @interface NasPreviewVideoViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>

+ 16 - 16
创维盒子/双子星云手机/NAS/nasLastFileViewController.m

@@ -215,24 +215,24 @@
         }
         else if([dataModel.type isEqualToString:@"audio"]){
             
-            NSMutableArray *audioDataArr = [NSMutableArray new];
-            NSInteger index = 0;
-            
-            for (int i=0; i<_lastFileDataArr.count; i++) {
-                lastFileModel* audioDataModel = _lastFileDataArr[i];
-                if([dataModel.type isEqualToString:@"audio"]){
-                    
-                    if(i == row){
-                        index = audioDataArr.count;
-                    }
-                    
-                    [audioDataArr addObject:audioDataModel];
-                }
-            }
+//            NSMutableArray *audioDataArr = [NSMutableArray new];
+//            NSInteger index = 0;
+//            
+//            for (int i=0; i<_lastFileDataArr.count; i++) {
+//                lastFileModel* audioDataModel = _lastFileDataArr[i];
+//                if([dataModel.type isEqualToString:@"audio"]){
+//                    
+//                    if(i == row){
+//                        index = audioDataArr.count;
+//                    }
+//                    
+//                    [audioDataArr addObject:audioDataModel];
+//                }
+//            }
             
             audioPlayerViewController *vc = [audioPlayerViewController new];
-            vc.index = index;
-            vc.audioOutSidedataArray = audioDataArr;
+            vc.isfirstEnterType = YES;
+            vc.outSideDataModel = (NASFileAudioDataModel *)dataModel;
             [self.navigationController pushViewController:vc animated:YES];
             
             KWeakSelf

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

@@ -193,6 +193,9 @@ typedef NS_ENUM(NSUInteger, DFPlayerStatusCode) {
  */
 @property (nonatomic, assign) BOOL isObserveFileModifiedTime;
 
+/** model数据数组 */
+@property (nonatomic, strong) NSMutableArray<DFPlayerModel *> *playerModelArray;
+
 /**
  单例
  */

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

@@ -47,8 +47,7 @@ NSString * const DFPlaybackLikelyToKeepUpKey    = @"playbackLikelyToKeepUp";
 @property (nonatomic, strong) NSMutableArray    *randomIndexArray;
 /** 资源下载器 */
 @property (nonatomic, strong) DFPlayerResourceLoader *resourceLoader;
-/** model数据数组 */
-@property (nonatomic, strong) NSMutableArray<DFPlayerModel *> *playerModelArray;
+
 
 @property (nonatomic, copy) void(^seekCompletionBlock)(void);