|
@@ -221,6 +221,8 @@
|
|
|
|
|
|
[self.dbHelper openResourceDBSuccess:nil failure:nil];
|
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -232,6 +234,8 @@
|
|
|
[self.view addSubview:self.magicCameraView];
|
|
|
self.view.backgroundColor = _uiConfig.backgroundColor;
|
|
|
[self.view addSubview:self.filterView];
|
|
|
+ [self.view addSubview:self.musicView];
|
|
|
+ [self.musicView addVisualEffect];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -524,7 +528,7 @@
|
|
|
return [NSURL fileURLWithPath:path];
|
|
|
|
|
|
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
// filePath就是你下载文件的位置,你可以解压,也可以直接拿来使用
|
|
|
NSString *musicFilePath = [filePath path];// 将NSURL转成NSString
|
|
|
// 应用音乐效果
|
|
@@ -534,7 +538,7 @@
|
|
|
AliyunEffectMusic *effectMusic = [[AliyunEffectMusic alloc] initWithFile:musicFilePath];
|
|
|
effectMusic.startTime = 0;
|
|
|
effectMusic.duration = musicDuration;
|
|
|
- [strongSelf.recorder applyMusic:effectMusic];
|
|
|
+ [weakSelf.recorder applyMusic:effectMusic];
|
|
|
}];
|
|
|
|
|
|
// 开始执行下载
|
|
@@ -587,9 +591,9 @@
|
|
|
self.magicCameraView.userInteractionEnabled = YES;
|
|
|
__weak __typeof(self)weakSelf = self;
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
|
|
|
- [strongSelf startRetainCameraRotate];
|
|
|
+ [weakSelf startRetainCameraRotate];
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -770,8 +774,8 @@
|
|
|
|
|
|
self.magicCameraView.rateView.hidden = false;
|
|
|
[UIView animateWithDuration:0.2 animations:^{
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf;
|
|
|
- strongSelf.musicView.frame = frame;
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf;
|
|
|
+ weakSelf.musicView.frame = frame;
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -793,8 +797,8 @@
|
|
|
__weak __typeof(self)weakSelf = self;
|
|
|
self.magicCameraView.rateView.hidden = false;
|
|
|
[UIView animateWithDuration:0.2 animations:^{
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
- strongSelf.filterView.frame = frame;
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
+ weakSelf.filterView.frame = frame;
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -836,23 +840,23 @@
|
|
|
__weak typeof(self) weakSelf = self;
|
|
|
|
|
|
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion * _Nullable motion, NSError * _Nullable error) {
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
// Gravity 获取手机的重力值在各个方向上的分量,根据这个就可以获得手机的空间位置,倾斜角度等
|
|
|
double gravityX = motion.gravity.x;
|
|
|
double gravityY = motion.gravity.y;
|
|
|
double xyTheta = atan2(gravityX,gravityY)/M_PI*180.0;//手机旋转角度。
|
|
|
if (xyTheta >= -45 && xyTheta <= 45) {
|
|
|
//down
|
|
|
- strongSelf.cameraRotate =180;
|
|
|
+ weakSelf.cameraRotate =180;
|
|
|
} else if (xyTheta > 45 && xyTheta < 135) {
|
|
|
//left
|
|
|
- strongSelf.cameraRotate = 90;
|
|
|
+ weakSelf.cameraRotate = 90;
|
|
|
} else if ((xyTheta >= 135 && xyTheta < 180) || (xyTheta >= -180 && xyTheta < -135)) {
|
|
|
//up
|
|
|
- strongSelf.cameraRotate = 0;
|
|
|
+ weakSelf.cameraRotate = 0;
|
|
|
} else if (xyTheta >= -135 && xyTheta < -45) {
|
|
|
//right
|
|
|
- strongSelf.cameraRotate = 270;
|
|
|
+ weakSelf.cameraRotate = 270;
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
@@ -863,10 +867,10 @@
|
|
|
|
|
|
__weak __typeof(self)weakSelf = self;
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
-// CGFloat percent = duration / _clipManager.maxDuration;
|
|
|
- [strongSelf.magicCameraView recordingPercent:duration];
|
|
|
- strongSelf.recordingDuration = duration;
|
|
|
+ // __strong __typeof(weakSelf)strongSelf = weakSelf; //3
|
|
|
+// CGFloat percent = duration / weakSelf.clipManager.maxDuration;
|
|
|
+ [weakSelf.magicCameraView recordingPercent:duration];
|
|
|
+ weakSelf.recordingDuration = duration;
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1057,7 +1061,7 @@
|
|
|
_filterView = [[AliyunEffectFilterView alloc]
|
|
|
initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, 180)];
|
|
|
_filterView.delegate = (id<AliyunEffectFilter2ViewDelegate>)self;
|
|
|
- [self.view addSubview:_filterView];
|
|
|
+// [self.view addSubview:_filterView];
|
|
|
[_filterView addVisualEffect];
|
|
|
}
|
|
|
return _filterView;
|
|
@@ -1067,8 +1071,6 @@
|
|
|
- (PublishRecordMusicView *)musicView {
|
|
|
if (!_musicView) {
|
|
|
_musicView = [[PublishRecordMusicView alloc] initWithFrame:CGRectMake(0, ScreenHeight, ScreenWidth, ScreenHeight - SafeTop - SafeBottom - 22)];
|
|
|
- [self.view addSubview:_musicView];
|
|
|
- [_musicView addVisualEffect];
|
|
|
}
|
|
|
return _musicView;
|
|
|
}
|