|
@@ -103,6 +103,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
progressThumV.isHidden = false
|
|
|
cameraProgressThumV.isHidden = true
|
|
|
progreddL.isHidden = false
|
|
|
+ cameraFlipBtn.isHidden = true
|
|
|
|
|
|
case .Video:
|
|
|
rscurrentManager = rsvmanager
|
|
@@ -110,7 +111,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
progressThumV.isHidden = false
|
|
|
cameraProgressThumV.isHidden = true
|
|
|
progreddL.isHidden = false
|
|
|
-
|
|
|
+ cameraFlipBtn.isHidden = true
|
|
|
+
|
|
|
case .Camera:
|
|
|
rscurrentManager = rscmanager
|
|
|
recordBtn.setTitle("record_lz".BFLocale, for: .normal)
|
|
@@ -119,7 +121,8 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
cameraProgressThumV.isHidden = false
|
|
|
progreddL.isHidden = true
|
|
|
rscmanager.cameraProgressV = cameraProgressThumV
|
|
|
-
|
|
|
+ cameraFlipBtn.isHidden = false
|
|
|
+
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
@@ -136,6 +139,9 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
rscmanager.rendView.snp.makeConstraints { make in
|
|
|
make.edges.equalToSuperview()
|
|
|
}
|
|
|
+ rscmanager.cameraFlipHandle = {[weak cell] isFrontCamera in
|
|
|
+ (cell as? BFCameraCoverViewCell)?.mirrorCamera(isFrontCamera)
|
|
|
+ }
|
|
|
|
|
|
} else {
|
|
|
progressThumV.isHidden = false
|
|
@@ -170,6 +176,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
public var displayLink: CADisplayLink? // 图片素材播放控制
|
|
|
|
|
|
+ var canInsertVideo = false
|
|
|
public var isRecording = false { // 是否正在录音
|
|
|
didSet {
|
|
|
withDrawBtn.isHidden = isRecording
|
|
@@ -425,6 +432,19 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
btn.titleEdgeInsets = UIEdgeInsets(top: 20, left: -40, bottom: -20, right: 0)
|
|
|
return btn
|
|
|
}()
|
|
|
+
|
|
|
+
|
|
|
+ // 镜头反转设置
|
|
|
+ lazy var cameraFlipBtn: UIButton = {
|
|
|
+ let btn = UIButton(type: .custom)
|
|
|
+ btn.setImage(imageInRecordScreenKit(by: "flip"), for: .normal)
|
|
|
+// btn.setTitle("function_cameraFlip".BFLocale, for: .normal)
|
|
|
+ btn.titleLabel?.font = UIFont.systemFont(ofSize: 10)
|
|
|
+ btn.addTarget(self, action: #selector(cameraFlipAction), for: .touchUpInside)
|
|
|
+ btn.imageEdgeInsets = UIEdgeInsets(top: -20, left: 4, bottom: 0, right: -4)
|
|
|
+ btn.titleEdgeInsets = UIEdgeInsets(top: 20, left: -40, bottom: -20, right: 0)
|
|
|
+ return btn
|
|
|
+ }()
|
|
|
|
|
|
|
|
|
// 字幕设置面板
|
|
@@ -607,6 +627,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
super.viewDidLoad()
|
|
|
_ = disablePopGesture()
|
|
|
|
|
|
+ let doubleTapGes = UITapGestureRecognizer(target: self, action: #selector(doubleTapAction(tap:)))
|
|
|
+ doubleTapGes.numberOfTapsRequired = 2
|
|
|
+ doubleTapGes.numberOfTouchesRequired = 1
|
|
|
+ view.addGestureRecognizer(doubleTapGes)
|
|
|
+
|
|
|
// 进入活跃状态
|
|
|
PQNotification.addObserver(self, selector: #selector(didBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil)
|
|
|
PQNotification.addObserver(self, selector: #selector(routeChangeNofify(nofify:)), name: AVAudioSession.routeChangeNotification, object: nil)
|
|
@@ -638,13 +663,13 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
view.addSubview(bottomeView)
|
|
|
// view.addSubview(subtitleLabel)
|
|
|
view.addSubview(playBtn)
|
|
|
- view.addSubview(avatarView)
|
|
|
+// view.addSubview(avatarView)
|
|
|
// view.addSubview(openCameraBtn)
|
|
|
// view.addSubview(drawPinBtn)
|
|
|
view.addSubview(subtitleBtn)
|
|
|
view.addSubview(soundSettingBtn)
|
|
|
+ view.addSubview(cameraFlipBtn)
|
|
|
view.addSubview(subtitleSettingView)
|
|
|
-
|
|
|
view.addSubview(audioSettingView)
|
|
|
|
|
|
bottomeView.addSubview(progreddL)
|
|
@@ -783,6 +808,12 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
make.right.width.height.equalTo(soundSettingBtn)
|
|
|
make.top.equalTo(soundSettingBtn.snp.bottom).offset(18)
|
|
|
}
|
|
|
+
|
|
|
+ cameraFlipBtn.snp.makeConstraints { make in
|
|
|
+ make.left.equalTo(8)
|
|
|
+ make.top.equalTo(soundSettingBtn)
|
|
|
+ make.width.height.equalTo(48)
|
|
|
+ }
|
|
|
|
|
|
withDrawBtn.imageEdgeInsets = UIEdgeInsets(top: -withDrawBtn.imageView!.height, left: 0, bottom: 0, right: -withDrawBtn.titleLabel!.width)
|
|
|
withDrawBtn.titleEdgeInsets = UIEdgeInsets(top: withDrawBtn.titleLabel!.height + 2, left: -withDrawBtn.imageView!.width, bottom: 0, right: 0)
|
|
@@ -1185,6 +1216,18 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
audioSettingView.isHidden = false
|
|
|
}
|
|
|
+
|
|
|
+ @objc func doubleTapAction(tap:UITapGestureRecognizer) {
|
|
|
+ if currMediaType == .Camera {
|
|
|
+ rscmanager.cameraFlip()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func cameraFlipAction(){
|
|
|
+ if currMediaType == .Camera {
|
|
|
+ rscmanager.cameraFlip()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/// 删除指定段落的所有字幕 数据
|
|
|
/// - Parameter voiceModel: 删除的音频数据
|
|
@@ -1295,6 +1338,11 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
// 录制中不显示播放按钮
|
|
|
playBtn.isSelected = true
|
|
|
playBtn.isHidden = true
|
|
|
+ if currMediaType == .Camera {
|
|
|
+ cameraFlipBtn.isHidden = true
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
let cell = collectionView.cellForItem(at: IndexPath(item: currItemModelIndex, section: 0)) as? BFImageCoverViewCell
|
|
|
if cell?.contentView.viewWithTag(100_100)?.superview == nil {
|
|
|
cell?.contentView.addSubview(subtitleLabel)
|
|
@@ -1308,7 +1356,10 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
if currMediaType == .Video {
|
|
|
pause()
|
|
|
+ }else if currMediaType == .Camera {
|
|
|
+ cameraFlipBtn.isHidden = false
|
|
|
}
|
|
|
+
|
|
|
beginOnStartBtn = false
|
|
|
|
|
|
BFLog(1, message: "停止录音- \(currentAssetProgress.seconds)")
|
|
@@ -1334,15 +1385,6 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
}
|
|
|
recorderManager?.stopRecord(isCancel: false)
|
|
|
|
|
|
- /*
|
|
|
- if currentAssetProgress.seconds - (recorderManager?.voiceModel?.startCMTime.seconds ?? 0 ) >= 1.0 {
|
|
|
- recorderManager?.stopRecord(isCancel: false)
|
|
|
- changeWithDrawBtnLayout(2)
|
|
|
- }else{
|
|
|
- recorderManager?.stopRecord(isCancel: true)
|
|
|
- changeProgress(progress: Float(recorderManager?.voiceModel?.startCMTime.seconds ?? 0))
|
|
|
- }
|
|
|
- */
|
|
|
if !avatarView.isHidden {
|
|
|
avatarView.endRecord()
|
|
|
}
|
|
@@ -1676,6 +1718,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
var startTime: CMTime?
|
|
|
var endTime: CMTime?
|
|
|
+ canInsertVideo = false
|
|
|
isStopAtRecordRange = -1
|
|
|
|
|
|
isEndPlay = (CMTimeCompare(currentAssetProgress, rscurrentManager.recordItem?.materialDuraion ?? .zero) >= 0)
|
|
@@ -1741,6 +1784,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
|
|
|
updatePlayBtnStatus()
|
|
|
}
|
|
|
+
|
|
|
func updatePlayBtnStatus(){
|
|
|
switch currMediaType {
|
|
|
case .Image:
|
|
@@ -1767,7 +1811,7 @@ public class BFRecordScreenController: BFBaseViewController {
|
|
|
recordBtn.isHidden = isEndPlay ? false : su
|
|
|
}
|
|
|
|
|
|
- deleteRecordBtn.isHidden = isEndPlay ? true : !su
|
|
|
+ deleteRecordBtn.isHidden = isEndPlay ? true : !(recordBtn.isHidden)
|
|
|
}
|
|
|
|
|
|
// MARK: - 权限申请
|