|
@@ -116,6 +116,7 @@
|
|
|
// 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:@"appEnterForeground" object:nil];
|
|
|
}
|
|
|
|
|
|
- (void)connectSocketService {
|
|
@@ -193,6 +194,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;
|
|
@@ -315,6 +324,7 @@
|
|
|
didReceiveScriptMessage:(WKScriptMessage *)message {
|
|
|
if ([message.name isEqualToString:@"COLEXIU"]) {
|
|
|
NSDictionary *parm = [self convertJsonStringToNSDictionary:message.body];
|
|
|
+ NSLog(@"---- receive parm %@", [parm mj_JSONString]);
|
|
|
// 回到主线程
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
if ([[parm stringValueForKey:@"api"] isEqualToString:@"startEvaluating"]) { // 开始评测
|
|
@@ -441,18 +451,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];
|
|
|
}];
|
|
|
}
|
|
|
}
|
|
@@ -719,7 +730,7 @@
|
|
|
}
|
|
|
|
|
|
} faliure:^(NSError * _Nonnull error) {
|
|
|
- faliure();
|
|
|
+// faliure();
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -877,7 +888,7 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark-------- KSAQRecordManagerDelegate
|
|
|
-- (void)audioRecordInterruption {
|
|
|
+- (void)recordInterruption {
|
|
|
NSDictionary *postParm = @{@"api" : @"cancelEvaluating",
|
|
|
@"content" : @{@"reson":@"录制错误,请重试"}
|
|
|
};
|
|
@@ -911,6 +922,7 @@
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
NSDictionary *postParm = @{@"api" : @"listenerWiredStatus",
|
|
|
@"content" : @{@"type":valueStr,
|
|
|
@"checkIsWired":[NSNumber numberWithBool:checkIsWired]
|
|
@@ -960,7 +972,7 @@
|
|
|
NSString *startString = [self configDataCommond:checkStartMessage body:nil type:@"PITCH_DETECTION"];
|
|
|
[self sendDataToSocketService:startString];
|
|
|
}
|
|
|
- NSLog(@"--------- send audio data length %d", length);
|
|
|
+// NSLog(@"--------- send audio data length %d", length);
|
|
|
[self sendDataToSocketService:pushData];
|
|
|
}
|
|
|
|
|
@@ -1028,7 +1040,6 @@
|
|
|
|
|
|
}
|
|
|
}];
|
|
|
-// _videoRecordManager.bgAudioUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"banzou" ofType:@"mp3"]];
|
|
|
}
|
|
|
return _videoRecordManager;
|
|
|
}
|