Steven 4 år sedan
förälder
incheckning
b97f3797a6

+ 20 - 0
MusicGradeExam/MusicGradeExam.xcodeproj/project.pbxproj

@@ -354,6 +354,9 @@
 		27A008F924BDB6310002452B /* UserBodyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 27A008F824BDB6310002452B /* UserBodyView.xib */; };
 		27A008FC24BECDC40002452B /* HomeBodyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27A008FB24BECDC40002452B /* HomeBodyView.m */; };
 		27A008FE24BECDFC0002452B /* HomeBodyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 27A008FD24BECDFC0002452B /* HomeBodyView.xib */; };
+		27B9066D2542AFE900A1BEBF /* tips_second.caf in Resources */ = {isa = PBXBuildFile; fileRef = 27B9066A2542AFE900A1BEBF /* tips_second.caf */; };
+		27B9066E2542AFE900A1BEBF /* tips_one.caf in Resources */ = {isa = PBXBuildFile; fileRef = 27B9066B2542AFE900A1BEBF /* tips_one.caf */; };
+		27B9066F2542AFE900A1BEBF /* tips_third.caf in Resources */ = {isa = PBXBuildFile; fileRef = 27B9066C2542AFE900A1BEBF /* tips_third.caf */; };
 		27D4149824CA741D000DBC0C /* RecordExamModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D4149724CA741D000DBC0C /* RecordExamModel.m */; };
 		27D4149B24CA757A000DBC0C /* SongModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D4149A24CA757A000DBC0C /* SongModel.m */; };
 		27DBF9D324D8F67B00202145 /* KSStatusView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27DBF9D224D8F67B00202145 /* KSStatusView.m */; };
@@ -1047,6 +1050,9 @@
 		27A008FA24BECDC40002452B /* HomeBodyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeBodyView.h; sourceTree = "<group>"; };
 		27A008FB24BECDC40002452B /* HomeBodyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeBodyView.m; sourceTree = "<group>"; };
 		27A008FD24BECDFC0002452B /* HomeBodyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeBodyView.xib; sourceTree = "<group>"; };
+		27B9066A2542AFE900A1BEBF /* tips_second.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = tips_second.caf; sourceTree = "<group>"; };
+		27B9066B2542AFE900A1BEBF /* tips_one.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = tips_one.caf; sourceTree = "<group>"; };
+		27B9066C2542AFE900A1BEBF /* tips_third.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = tips_third.caf; sourceTree = "<group>"; };
 		27D4149624CA741D000DBC0C /* RecordExamModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordExamModel.h; sourceTree = "<group>"; };
 		27D4149724CA741D000DBC0C /* RecordExamModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecordExamModel.m; sourceTree = "<group>"; };
 		27D4149924CA757A000DBC0C /* SongModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SongModel.h; sourceTree = "<group>"; };
@@ -1272,6 +1278,7 @@
 		27476F4524BBFB5900181362 /* MusicGradeExam */ = {
 			isa = PBXGroup;
 			children = (
+				27B9065D2542ABE000A1BEBF /* TipsAudio */,
 				27E32B0024ECD9910007CA8F /* 酷乐秀.entitlements */,
 				2747718624BC0C0400181362 /* KSRequestManager.h */,
 				2747700224BC0C0000181362 /* KSRequestManager.m */,
@@ -2671,6 +2678,16 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		27B9065D2542ABE000A1BEBF /* TipsAudio */ = {
+			isa = PBXGroup;
+			children = (
+				27B9066B2542AFE900A1BEBF /* tips_one.caf */,
+				27B9066A2542AFE900A1BEBF /* tips_second.caf */,
+				27B9066C2542AFE900A1BEBF /* tips_third.caf */,
+			);
+			path = TipsAudio;
+			sourceTree = "<group>";
+		};
 		27EF3F0A24C02B67002068A2 /* TipsView */ = {
 			isa = PBXGroup;
 			children = (
@@ -2898,6 +2915,7 @@
 				27476F5624BBFB5C00181362 /* LaunchScreen.storyboard in Resources */,
 				273EFB6324DD36420069DB4D /* RCColor.plist in Resources */,
 				273EFB6424DD36420069DB4D /* RongCloudKit.strings in Resources */,
+				27B9066D2542AFE900A1BEBF /* tips_second.caf in Resources */,
 				278D113E24CFC6B600599421 /* ExamDeviceCheckView.xib in Resources */,
 				2729F7EC24C8329700E1F3C4 /* RecordBodyView.xib in Resources */,
 				27EF3EF824BEF1E8002068A2 /* TicketBodyView.xib in Resources */,
@@ -2917,6 +2935,7 @@
 				2729F7F124C8379D00E1F3C4 /* RecordListCell.xib in Resources */,
 				2794D1BA24BC69A400BAF6F3 /* RegisterBodyView.xib in Resources */,
 				27DBF9D824DAAE7500202145 /* WaitExamBottomView.xib in Resources */,
+				27B9066F2542AFE900A1BEBF /* tips_third.caf in Resources */,
 				27A008DE24BDA6950002452B /* PhoneCheckBodyView.xib in Resources */,
 				27476F5324BBFB5C00181362 /* Assets.xcassets in Resources */,
 				27A008AE24BD96E50002452B /* DeviceCheckView.xib in Resources */,
@@ -2931,6 +2950,7 @@
 				27EF3F0024BF016B002068A2 /* WaitExamBodyView.xib in Resources */,
 				27A008A924BD96C50002452B /* KSNetworkAlert.xib in Resources */,
 				27EF3F2F24C0384E002068A2 /* HomeExamTicketCell.xib in Resources */,
+				27B9066E2542AFE900A1BEBF /* tips_one.caf in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

BIN
MusicGradeExam/MusicGradeExam/TipsAudio/tips_one.caf


BIN
MusicGradeExam/MusicGradeExam/TipsAudio/tips_second.caf


BIN
MusicGradeExam/MusicGradeExam/TipsAudio/tips_third.caf


+ 49 - 19
MusicGradeExam/MusicGradeExam/UI/RecordAction/KSVideoRecordViewController.m

@@ -17,6 +17,8 @@
 
 @interface KSVideoRecordViewController ()<AVCaptureFileOutputRecordingDelegate>
 
+@property (nonatomic, strong) AVAudioPlayer *audioPlayer;
+
 //会话 负责输入和输出设备之间的数据传递
 @property (nonatomic, strong) AVCaptureSession *captureSession;
 
@@ -181,6 +183,28 @@
     [self.view addSubview:self.viewContainer];
     [self configSongCardView];
     self.songCardView.hidden = YES;
+    
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self playTipsWithFileName:@"tips_one"];
+    });
+    
+}
+
+
+- (void)playTipsWithFileName:(NSString *)fileName {
+    
+    // 播放提示音
+    NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@"caf"];
+    if (path) {
+        NSURL *pathUrl = [NSURL fileURLWithPath:path];
+        NSError *error = nil;
+        self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:pathUrl error:&error];
+        self.audioPlayer.volume = 1.0f;
+        [self.audioPlayer prepareToPlay];
+        if (error == nil) {
+            [self.audioPlayer play];
+        }
+    }
 }
 
 - (void)configSongCardView {
@@ -228,25 +252,28 @@
     self.songTimeLabel.text = [NSString stringWithFormat:@"当前曲目剩余时间:%zds",self.songCountTime];
 }
 
--(void)viewDidAppear:(BOOL)animated{
+-(void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     [self.captureSession startRunning];
 }
- 
--(void)viewDidDisappear:(BOOL)animated{
+
+-(void)viewDidDisappear:(BOOL)animated {
     [super viewDidDisappear:animated];
     [self.captureSession stopRunning];
     [self stopDurationTimer];
 }
+
 #pragma mark ---- buttonAction
 - (void)bottomButtonAction:(UIButton *)sender {
     
     if ([sender.titleLabel.text isEqualToString:@"已就位"]) {
+        [self playTipsWithFileName:@"tips_second"];
         [sender setTitle:@"开始考级" forState:UIControlStateNormal];
     }
     else if ([sender.titleLabel.text isEqualToString:@"开始考级"]) {
         self.isPrepare = YES;
         self.topTipsLabel.text = @"请考生在10秒内就位演奏";
+        [self playTipsWithFileName:@"tips_third"];
         self.topTipsView.hidden = NO;
         self.bottomCountLabel.hidden = NO;
         if (self.currentRecordIndex + 1 == self.songMessageArray.count) {
@@ -259,21 +286,10 @@
     }
     else if ([sender.titleLabel.text isEqualToString:@"下一首"]) {
         
-        [KSNormalAlertView ks_showAlertWithTitle:@"确定切换下一吗?" leftTitle:@"取消" rightTitle:@"确定" cancel:^{
+        [KSNormalAlertView ks_showAlertWithTitle:@"确定切换下一吗?" leftTitle:@"取消" rightTitle:@"确定" cancel:^{
             
         } confirm:^{
-            self.currentRecordIndex++;
-            self.topTipsLabel.text = @"请考生在10秒内就位演奏";
-            self.prepareTime = 10;
-            self.isPrepare = YES;
-            [self.captureMovieFileOutput stopRecording];
-            if (self.currentRecordIndex + 1 == self.songMessageArray.count) {
-                [sender setTitle:@"完成录制" forState:UIControlStateNormal];
-            }
-            else {
-                [sender setTitle:@"下一首" forState:UIControlStateNormal];
-            }
-            sender.hidden = YES;
+            [self nextSongAction];
         }];
         
     }
@@ -298,6 +314,21 @@
     }
 }
 
+- (void)nextSongAction {
+    self.currentRecordIndex++;
+    self.topTipsLabel.text = @"请考生在10秒内就位演奏";
+    self.prepareTime = 10;
+    self.isPrepare = YES;
+    [self.captureMovieFileOutput stopRecording];
+    if (self.currentRecordIndex + 1 == self.songMessageArray.count) {
+        [self.bottomButton setTitle:@"完成录制" forState:UIControlStateNormal];
+    }
+    else {
+        [self.bottomButton setTitle:@"下一首" forState:UIControlStateNormal];
+    }
+    self.bottomButton.hidden = YES;
+}
+
 - (void)setCurrentRecordIndex:(NSInteger)currentRecordIndex {
     _currentRecordIndex = currentRecordIndex;
     self.songCountTime = self.singleSongRecordMinutes * 60;
@@ -516,8 +547,8 @@
             }
             if (self.songCountTime == 0) {
                 _isStartExam = NO;
-                // 切换下一
-                [self bottomButtonAction:self.bottomButton];
+                // 切换下一
+                [self nextSongAction];
             }
         }
     }
@@ -647,7 +678,6 @@
 }
 
 
-
 /*
 #pragma mark - Navigation