Forráskód Böngészése

1.录音需求--进行中

huangxiaodong 2 hónapja%!(EXTRA string=óta)
szülő
commit
4e96c27a99

+ 2 - 0
创维盒子/code/mine/AudioRecorderManager/AudioRecorderManager.h

@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, strong) AVAudioPlayer *audioPlayer;
 @property (nonatomic, copy) NSString *recordedFilePath;
 
+@property (nonatomic, copy) NSString *curRecordName;
+
 + (instancetype)sharedManager;
 
 - (void)startRecording;

+ 5 - 1
创维盒子/code/mine/AudioRecorderManager/AudioRecorderManager.m

@@ -45,7 +45,11 @@
     
     // 设置录音文件路径
     NSString *documentsPath = kSHPath_Record;
-    self.recordedFilePath = [documentsPath stringByAppendingPathComponent:@"recording.m4a"];
+    NSString*fileName = [AudioRecorderManager sharedManager].curRecordName;
+    if(!fileName){
+        fileName = @"1111.m4a";
+    }
+    self.recordedFilePath = [documentsPath stringByAppendingPathComponent:fileName];
     NSURL *outputFileURL = [NSURL fileURLWithPath:self.recordedFilePath];
     
     // 录音设置

+ 35 - 22
创维盒子/code/mine/recordViewController.m

@@ -101,19 +101,19 @@
 
 #pragma mark - 列表委托
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-    return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     if(!_audioArr){
         return 0;
     }
     return _audioArr.count;
 }
 
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return 1;
+}
+
 - (recordFileCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
     
-    __block NSInteger row = indexPath.row;
+    __block NSInteger row = indexPath.section;
     static NSString *identifier = @"recordFileCell";
     
     recordFileCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
@@ -143,7 +143,7 @@
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
     
-    NSInteger row = indexPath.row;
+    NSInteger row = indexPath.section;
     if(row >=_audioArr.count){
         return 0.0;
     }
@@ -156,22 +156,26 @@
     return 65;
 }
 
+- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
+{
+    return [UIView new];
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
+    return 12.0;
+}
+
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    NSInteger row = indexPath.row;
-//    if(row < _curNASFileAudioMod.data.list.count){
-//        
-//        NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
-//        //videoPlayViewController *vc = [videoPlayViewController new];
-//        videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
-//        vc.VideoDataMode = dataModel;
-//        [self.navigationController pushViewController:vc animated:YES];
-//        
-//        KWeakSelf
-//        vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
-//            [weakSelf deleteNetDataByFilePath:filePath];
-//        };
-//    }
+    NSInteger row = indexPath.section;
+    if(row < _audioArr.count){
+        recordFileModel *model = _audioArr[row];
+        if(!model.showAllType){
+            model.showAllType = YES;
+            
+            [tableView reloadData];
+        }
+    }
 }
 
 #pragma mark 空数据
@@ -183,7 +187,7 @@
 }
 
 - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
-    NSString *text = NSLocalizedString(@"common_no_data_tip",nil);
+    NSString *text = NSLocalizedString(@"record_no_data_tip",nil);
     
     NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
                                  NSForegroundColorAttributeName: HW999999Color};
@@ -210,6 +214,7 @@
         HLog(@"Error reading contents of directory: %@", error.localizedDescription);
     }
     
+    [_audioArr removeAllObjects];
     BOOL isFirstType = YES;
     
     for (NSString *fileName in fileList) {
@@ -242,6 +247,10 @@
         
         if (isFirstType) {
             model.showAllType  = YES;
+            isFirstType = NO;
+        }
+        else{
+            model.showAllType  = NO;
         }
         
         // 创建文件信息字典
@@ -328,7 +337,8 @@
         make.top.mas_equalTo(0);
     }];
     
-    [_recordingV beginRecordFun];
+    NSInteger index = _audioArr.count + 1;
+    [_recordingV beginRecordFunWith:index];
     
     KWeakSelf
     _recordingV.didClickRecordEndFun = ^{
@@ -341,6 +351,9 @@
 {
     [_recordingV removeFromSuperview];
     _recordingV = nil;
+    
+    [self getRecordDataFun];
+    [self.tableView reloadData];
 }
 
 @end

+ 1 - 1
创维盒子/code/mine/view/recordingView.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 @interface recordingView : UIView
 @property (nonatomic,copy) void (^didClickRecordEndFun)(void);
 
-- (void)beginRecordFun;
+- (void)beginRecordFunWith:(NSInteger)curIndex;
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 1
创维盒子/code/mine/view/recordingView.m

@@ -70,8 +70,9 @@
 }
 
 #pragma mark 开始录音
-- (void)beginRecordFun
+- (void)beginRecordFunWith:(NSInteger)curIndex;
 {
+    [AudioRecorderManager sharedManager].curRecordName = [[NSString alloc] initWithFormat:@"record%ld.m4a",curIndex];
     [[AudioRecorderManager sharedManager] startRecording];
 }
 

+ 1 - 0
创维盒子/code/zh-Hans.lproj/Localizable.strings

@@ -674,3 +674,4 @@
 //1.4.4 (1.4.5) 1.10
 "mine_record_title"   = "录音机";
 "mine_record_microphone_tip"   = "麦克风权限被禁用,请到手机的设置页最后的APP菜单找到APP,打开并开启麦克风权限";
+"record_no_data_tip"   = "暂无录音";