Steven 2 年之前
父节点
当前提交
54de762073

+ 4 - 4
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -8556,7 +8556,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForTeacher/KulexiuForTeacher.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.4.4;
+				CURRENT_PROJECT_VERSION = 1.4.6;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -8602,7 +8602,7 @@
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/SocialLibraries/QQ",
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.4.5;
+				MARKETING_VERSION = 1.4.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForTeacher;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;
@@ -8622,7 +8622,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForTeacher/KulexiuForTeacher.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.4.4;
+				CURRENT_PROJECT_VERSION = 1.4.6;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -8668,7 +8668,7 @@
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/SocialLibraries/QQ",
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.4.5;
+				MARKETING_VERSION = 1.4.6;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForTeacher;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;

+ 15 - 4
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSAccompanyWebViewController.m

@@ -116,6 +116,8 @@
     // Do any additional setup after loading the view.
     [self configAudioSession];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnterBackground) name:@"appEnterBackground" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appEnterForeground) name:@"appBecomeActive" object:nil];
+    
 }
 
 - (void)connectSocketService {
@@ -193,6 +195,14 @@
     [self handerAudioInterruption];
 }
 
+- (void)appEnterForeground {
+    if (self.isCameraOpen) {
+        if ([self.videoRecordManager getSessionStatusisActive] == NO) {
+            [self.videoRecordManager configSessiondisplayInView:self.viewContainer];
+        }
+    }
+}
+
 - (void)initWebView {
     [self.view addSubview:self.navView];
     CGFloat topHeight = kNaviBarHeight;
@@ -442,18 +452,19 @@
                 NSMutableDictionary *sendParm = [NSMutableDictionary dictionaryWithDictionary:parm];
                 NSMutableDictionary *contentParm = [NSMutableDictionary dictionaryWithDictionary:[sendParm dictionaryValueForKey:@"content"]];
                 if (self.videoRecordManager) {
+                    MJWeakSelf;
                     [self.videoRecordManager uploadRecordVideoSuccess:^(NSString * _Nonnull videoUrl) {
                         [contentParm setValue:@"success" forKey:@"type"];
                         [contentParm setValue:videoUrl forKey:@"filePath"];
                         [contentParm setValue:@"上传成功" forKey:@"message"];
                         [sendParm setValue:contentParm forKey:@"content"];
                         
-                        [self postMessage:sendParm];
+                        [weakSelf postMessage:sendParm];
                     } failure:^(NSString * _Nonnull desc) {
                         [contentParm setValue:@"error" forKey:@"type"];
                         [contentParm setValue:desc forKey:@"message"];
                         [sendParm setValue:contentParm forKey:@"content"];
-                        [self postMessage:sendParm];
+                        [weakSelf postMessage:sendParm];
                     }];
                 }
             }
@@ -718,7 +729,7 @@
         }
         
     } faliure:^(NSError * _Nonnull error) {
-        faliure();
+
     }];
 }
 
@@ -876,7 +887,7 @@
 }
 
 #pragma mark-------- KSAQRecordManagerDelegate
-- (void)audioRecordInterruption {
+- (void)recordInterruption {
     NSDictionary *postParm = @{@"api" : @"cancelEvaluating",
                                @"content" : @{@"reson":@"录制错误,请重试"}
     };

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSVideoRecordManager.h

@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL skipSaveRecord;
 
+- (BOOL)getSessionStatusisActive;
+
 - (instancetype)initSessionRecordCallback:(KSVideoRecordCallback)callback;
 
 - (void)configSessiondisplayInView:(UIView *)containerView;

+ 44 - 5
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSVideoRecordManager.m

@@ -42,6 +42,8 @@
 
 @property (strong, nonatomic) MBProgressHUD *HUD;
 
+@property (nonatomic, strong) dispatch_queue_t videoRecordQueue;
+
 @end
 
 @implementation KSVideoRecordManager
@@ -61,6 +63,15 @@
     [self resetSession];
 }
 
+- (BOOL)getSessionStatusisActive {
+    if (self.captureSession && self.captureSession.isRunning) {
+        return YES;
+    }
+    else  {
+        return NO;
+    }
+}
+
 - (void)configSessiondisplayInView:(UIView *)containerView {
     _captureSession = [[AVCaptureSession alloc] init];
 
@@ -140,8 +151,7 @@
     // 一定要在添加了 input 和 output之后~
     AVCaptureConnection *captureConnection = [_captureMovieFileOutput connectionWithMediaType:AVMediaTypeVideo];
     captureConnection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
-    
-    [self.captureSession startRunning];
+    [self startSession];
 }
 
 - (void)removeDisplay {
@@ -180,13 +190,28 @@
         [_captureSession commitConfiguration];
         
     }
-    [self.captureSession startRunning];
+    [self startSession];
     
 }
+- (void)startSession {
+    @weakObj(self);
+    dispatch_async(self.videoRecordQueue, ^{
+        @strongObj(self);
+        if (!self.captureSession.running) {
+            [self.captureSession startRunning];
+        }
+    });
+}
 
 - (void)stopSession {
     if (_captureSession) {
-        [self.captureSession stopRunning];
+        @weakObj(self);
+        dispatch_async(self.videoRecordQueue, ^{
+            @strongObj(self);
+            if (self.captureSession.running) {
+                [self.captureSession stopRunning];
+            }
+        });
         self.captureSession = nil;
     }
 }
@@ -266,7 +291,13 @@
     }
     NSLog(@"录制结束");
     _isRecording = NO;
-    [self.captureSession stopRunning];
+    @weakObj(self);
+    dispatch_async(self.videoRecordQueue, ^{
+        @strongObj(self);
+        if (self.captureSession.running) {
+            [self.captureSession stopRunning];
+        }
+    });
     // 暂时存储文件地址
     self.videoFileURL = outputFileURL;
     // 保存文件
@@ -435,4 +466,12 @@
     NSString *filePath = [path stringByAppendingPathComponent:fileName];
     return filePath;
 }
+
+- (dispatch_queue_t)videoRecordQueue {
+    if (!_videoRecordQueue) {
+        _videoRecordQueue = dispatch_queue_create("com.Colexiu.videoRecord", DISPATCH_QUEUE_SERIAL);
+    }
+    return _videoRecordQueue;
+}
+
 @end

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Login/View/VefiBodyView.m

@@ -111,10 +111,10 @@
         sender.text = [sender.text substringFromIndex:sender.text.length - _codeCount];
         [self hideKeyboard];
     }
-    if (sender.text.length == self.codeCount) {
+    else if (sender.text.length == self.codeCount) {
         [self hideKeyboard];
     }
-    if (sender.text.length >= _codeCount + 1) { //对于持续输入,只要前面N个就行
+    else if (sender.text.length >= _codeCount + 1) { //对于持续输入,只要前面N个就行
         NSLog(@"持续输入");
         sender.text = [sender.text substringToIndex:_codeCount];
         [self hideKeyboard];

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Widget/View/Metronome/WidgetSpeedView.m

@@ -38,7 +38,7 @@
 - (void)createUI {
     _centerPoint = CGPointMake(300 / 2, kScreenWidth / 2);//中心点
     
-    self.controlSpeedView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"speed_dot"]];
+    self.controlSpeedView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"speed_dot_s"]];
     [self.bgView addSubview:self.controlSpeedView];
     [self.controlSpeedView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.right.bottom.left.mas_equalTo(self.bgView);