Pārlūkot izejas kodu

连接字幕编辑 和 设置方法逻辑

jsonwang 3 gadi atpakaļ
vecāks
revīzija
ff7a9b19a4

+ 200 - 154
BFRecordScreenKit/Classes/RecordScreen/Controller/BFRecordScreenController.swift

@@ -31,7 +31,7 @@ public class BFRecordScreenController: BFBaseViewController {
     
     var currItemModelIndex = 0
     public var itemModels = [BFRecordItemModel]()
-//    var shouldPlayRecordIndex:Int = -1          // 当前应该播放的录音资源序号
+    //    var shouldPlayRecordIndex:Int = -1          // 当前应该播放的录音资源序号
     var currentPlayRecordIndex:Int = -1         // >= 0 :当前正在播放的录音资源序号; -3: 刚录音完,不需要播放录音; -1:初始化阶段
     var isRecording = false {                   // 是否正在录音
         didSet{
@@ -56,7 +56,7 @@ public class BFRecordScreenController: BFBaseViewController {
     // 视频素材
     public var avasset:AVURLAsset?
     
-//    public var recordList:[PQVoiceModel] = [PQVoiceModel]()
+    //    public var recordList:[PQVoiceModel] = [PQVoiceModel]()
     
     var assetPlayer:AVPlayer?       // 原视频音频播放器
     var isCompletePlay = true
@@ -71,11 +71,11 @@ public class BFRecordScreenController: BFBaseViewController {
     var isStopAtRecordRange = -1
     //定义音频的编码参数
     let recordSettings:[String : Any] = [AVSampleRateKey : 44100.0, // 声音采样率
-                            AVFormatIDKey : kAudioFormatLinearPCM,  // 编码格式
-                    AVNumberOfChannelsKey : 1,                      // 采集音轨
-                  AVEncoderBitDepthHintKey: 16,                     // 位深
-                 AVEncoderAudioQualityKey : AVAudioQuality.medium.rawValue] //音频质量
-
+                                         AVFormatIDKey : kAudioFormatLinearPCM,  // 编码格式
+                                         AVNumberOfChannelsKey : 1,                      // 采集音轨
+                                         AVEncoderBitDepthHintKey: 16,                     // 位深
+                                         AVEncoderAudioQualityKey : AVAudioQuality.medium.rawValue] //音频质量
+    
     
     // 录音相关
     lazy var recorderManager : BFVoiceRecordManager = {
@@ -113,12 +113,12 @@ public class BFRecordScreenController: BFBaseViewController {
         }
         return manager
     }()
-
+    
     // MARK: - 视图参数
     var beginOnStartBtn:Bool = false
     var touchStart:CGPoint = CGPoint(x: 0, y: 0)
     var avplayerTimeObserver: NSKeyValueObservation?
-
+    
     lazy var progreddL : UILabel = {
         let l = UILabel()
         l.textAlignment = .center
@@ -159,7 +159,7 @@ public class BFRecordScreenController: BFBaseViewController {
         btn.adjustsImageWhenHighlighted = false
         btn.addTarget(self, action: #selector(startRecord), for: .touchDown)
         btn.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
-
+        
         return btn
     }()
     
@@ -204,7 +204,7 @@ public class BFRecordScreenController: BFBaseViewController {
         return toolV
         
     }()
- 
+    
     //头像  add by ak
     lazy var avatarView:BFRecordAvatarView = {
         let avatarView = BFRecordAvatarView.init(frame: CGRect.init(x: 10, y: 10, width: 120, height: 120))
@@ -225,7 +225,7 @@ public class BFRecordScreenController: BFBaseViewController {
         btn.addTarget(self, action: #selector(drawPin), for: .touchUpInside)
         return btn
     }()
- 
+    
     //字幕设置
     lazy var subtitleBtn:UIButton = {
         let btn = UIButton(type: .custom)
@@ -243,26 +243,35 @@ public class BFRecordScreenController: BFBaseViewController {
     }()
     
     //字幕设置面板
-    lazy var subtitleView:BFSubtitleSettingView = {
-        let subtitleView = BFSubtitleSettingView.init(frame: CGRect.init(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
-        subtitleView.isHidden = true
-        return subtitleView
+    lazy var subtitleSettingView:BFSubtitleSettingView = {
+        let subtitleSetting = BFSubtitleSettingView.init(frame: CGRect.init(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
+        subtitleSetting.isHidden = true
+        return subtitleSetting
     }()
     
     //编辑字幕
     lazy var subtitleEditView:BFSubtitleEditView = {
         let subtitleEditView = BFSubtitleEditView.init(frame: CGRect.init(x: 0, y: 0, width: cScreenWidth, height: cScreenHeigth))
         subtitleEditView.isHidden = true
-
+        
         return subtitleEditView
     }()
     
     //显示字幕
     lazy var subtitleLabel:PQSubTitleLabel = {
-        let subtitleLabel = PQSubTitleLabel.init(frame: CGRect.init(x: 0, y: 300, width: cScreenWidth, height: 60))
-        subtitleLabel.backgroundColor = .clear
+        
+        let test = "它实现了在深层CNN中执行了分辨率自适应的思想。它由具有不同输入分辨率的子网络组成,“简单”样本通过处理低分辨率特征图的子网络进行分类。当前一个子网未能达到给定标准时,将采用分辨率较高的子网"
+        let leftPoint:CGFloat = 37
+        let height = sizeWithText(text: test, font: UIFont.systemFont(ofSize: 70 * 375 / 1080), size: CGSize(width:  cScreenWidth - leftPoint * 2, height: 102))
+       
+        let subtitleLabel = PQSubTitleLabel.init(frame: CGRect.init(x: leftPoint, y:  (cScreenHeigth * 0.70 - height.height) , width: cScreenWidth - 37 * 2, height: height.height))
         subtitleLabel.textAlignment = .center
-     
+        subtitleLabel.text = test
+ 
+        subtitleLabel.numberOfLines = 0
+        subtitleLabel.lineBreakMode = .byClipping
+        subtitleLabel.isUserInteractionEnabled = true
+        subtitleLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(editSubtitle)))
         return subtitleLabel
         
     }()
@@ -285,7 +294,7 @@ public class BFRecordScreenController: BFBaseViewController {
                 }
                 sself.isDragingProgressSlder = true
                 BFLog(1, message: "drag 进行中")
-
+                
                 sself.changeProgress(progress: process)
             }
         }
@@ -299,7 +308,7 @@ public class BFRecordScreenController: BFBaseViewController {
         vv.isHidden = true
         return vv
     }()
- 
+    
     //MARK: ------------------ 生命周期
     deinit {
         cleanMovieTarget()
@@ -332,21 +341,21 @@ public class BFRecordScreenController: BFBaseViewController {
         view.addSubview(playBtn)
         view.addSubview(bottomeView)
         view.addSubview(avatarView)
-//        view.addSubview(openCameraBtn)
-//        view.addSubview(drawPinBtn)
+        //        view.addSubview(openCameraBtn)
+        //        view.addSubview(drawPinBtn)
         view.addSubview(subtitleBtn)
         view.addSubview(soundSettingBtn)
-        view.addSubview(subtitleView)
+        view.addSubview(subtitleSettingView)
         view.addSubview(subtitleLabel)
-      
+        
         
         bottomeView.addSubview(progreddL)
-//        view.addSubview(toolV)
+        //        view.addSubview(toolV)
         bottomeView.addSubview(recordBtn)
         bottomeView.addSubview(withDrawBtn)
-//        bottomeView.addSubview(changeVoiceBtn)
+        //        bottomeView.addSubview(changeVoiceBtn)
         bottomeView.addSubview(progressThumV)
-
+        
         if checkStatus() {
             try? AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: .defaultToSpeaker)
         }
@@ -356,12 +365,56 @@ public class BFRecordScreenController: BFBaseViewController {
             BFLog(message: "新录制完成::::\(materialsModel?.locationPath ?? "")")
         }
         
+        
+        //字幕设置回调
+        //设置默认值
+        setSubtitleStyle(settingModel: subtitleSettingView.subtitleSetting)
+        subtitleSettingView.subtitleSettingCallBack = {[weak self] settingModel in
+            
+            self?.setSubtitleStyle(settingModel: settingModel)
+            
+        }
+        subtitleEditView.editSubtitleDone = {[weak self] newtext in
+            self?.subtitleLabel.text = newtext
+        }
+        
         layoutsubview()
         
         view.addSubview(subtitleEditView)
     }
+    @objc func editSubtitle() {
+         
+        BFLog(message: "编辑字幕")
+        subtitleEditView.isHidden = false
+        subtitleEditView.textView.becomeFirstResponder()
+        subtitleEditView.settingModel = subtitleSettingView.subtitleSetting
+        
+        subtitleEditView.setNewText(text: subtitleLabel.text ?? "")
+    }
+    func setSubtitleStyle(settingModel:BFSubtitileSettingModel) {
+        
+        if(settingModel.subtitleIsShow){
+            //设置样式
+            subtitleLabel.strokeColor = settingModel.strokeColor
+            subtitleLabel.strokeWidth = settingModel.strokeWidth
+            subtitleLabel.font = UIFont.systemFont(ofSize: CGFloat(settingModel.subtitleSize) * 375 / 1080)
+            subtitleLabel.textColor = settingModel.fontColor
+ 
+            let leftPoint:CGFloat = 37
+            let height = sizeWithText(text: self.subtitleLabel.text ?? "", font: UIFont.systemFont(ofSize: 70 * 375 / 1080), size: CGSize(width:  cScreenWidth - leftPoint * 2, height: 102))
+        
+            //下 //设置位置
+            if(self.subtitleSettingView.subtitleSetting.subtitlePoint == 0){
+                self.subtitleLabel.frame =  CGRect.init(x: leftPoint, y:  (cScreenHeigth * 0.70 - height.height) , width: cScreenWidth - 37 * 2, height: height.height)
+            }else if(self.subtitleSettingView.subtitleSetting.subtitlePoint == 1){//中
+                self.subtitleLabel.frame =  CGRect.init(x: leftPoint, y:  (cScreenHeigth / 2.0 - height.height / 2.0) , width: cScreenWidth - 37 * 2, height: height.height)
+            }else{//上
+                self.subtitleLabel.frame =  CGRect.init(x: leftPoint, y:  (cScreenHeigth * 0.12) , width: cScreenWidth - 37 * 2, height: height.height)
+            }
+        }
+    }
     func layoutsubview() {
-
+        
         bottomeView.snp.makeConstraints { make in
             make.left.bottom.right.equalToSuperview()
             make.height.equalTo(adapterWidth(width: 220))
@@ -379,10 +432,10 @@ public class BFRecordScreenController: BFBaseViewController {
             make.width.height.equalTo(65)
             make.top.equalTo(128)
         }
-//        changeVoiceBtn.snp.makeConstraints { make in
-//            make.right.equalToSuperview()
-//            make.top.width.height.equalTo(withDrawBtn)
-//        }
+        //        changeVoiceBtn.snp.makeConstraints { make in
+        //            make.right.equalToSuperview()
+        //            make.top.width.height.equalTo(withDrawBtn)
+        //        }
         
         recordBtn.snp.makeConstraints { make in
             make.left.equalTo(withDrawBtn.snp.right)
@@ -390,20 +443,20 @@ public class BFRecordScreenController: BFBaseViewController {
             make.height.equalTo(42)
             make.top.equalTo(withDrawBtn).offset(6)
         }
-
-//        openCameraBtn.snp.makeConstraints { make in
-//            make.right.equalToSuperview().offset(-12)
-//            make.top.equalToSuperview().offset(98)
-//            make.width.equalTo(80)
-//            make.height.equalTo(124)
-//        }
-//
-//        drawPinBtn.snp.makeConstraints { make in
-//            make.right.equalTo(openCameraBtn)
-//            make.top.equalTo(openCameraBtn.snp.bottom).offset(18)
-//            make.width.equalTo(80)
-//            make.height.equalTo(124)
-//        }
+        
+        //        openCameraBtn.snp.makeConstraints { make in
+        //            make.right.equalToSuperview().offset(-12)
+        //            make.top.equalToSuperview().offset(98)
+        //            make.width.equalTo(80)
+        //            make.height.equalTo(124)
+        //        }
+        //
+        //        drawPinBtn.snp.makeConstraints { make in
+        //            make.right.equalTo(openCameraBtn)
+        //            make.top.equalTo(openCameraBtn.snp.bottom).offset(18)
+        //            make.width.equalTo(80)
+        //            make.height.equalTo(124)
+        //        }
         
         subtitleBtn.snp.makeConstraints { make in
             make.right.equalToSuperview().offset(-12)
@@ -411,7 +464,7 @@ public class BFRecordScreenController: BFBaseViewController {
             make.width.equalTo(40)
             make.height.equalTo(62)
         }
-    
+        
         soundSettingBtn.snp.makeConstraints { make in
             make.right.equalTo(subtitleBtn)
             make.top.equalTo(subtitleBtn.snp.bottom).offset(18)
@@ -424,14 +477,14 @@ public class BFRecordScreenController: BFBaseViewController {
         
         changeVoiceBtn.imageEdgeInsets = UIEdgeInsets(top: -changeVoiceBtn.imageView!.height-2, left: 0, bottom: 0, right: -changeVoiceBtn.titleLabel!.width);
         changeVoiceBtn.titleEdgeInsets = UIEdgeInsets(top: changeVoiceBtn.titleLabel!.height+2, left: -changeVoiceBtn.imageView!.width, bottom: 0, right: 0);
-
+        
         
     }
     
-//    public override func viewWillLayoutSubviews() {
-//        super.viewWillLayoutSubviews()
-//
-//    }
+    //    public override func viewWillLayoutSubviews() {
+    //        super.viewWillLayoutSubviews()
+    //
+    //    }
     
     // MARK: - 按钮事件响应
     
@@ -445,9 +498,9 @@ public class BFRecordScreenController: BFBaseViewController {
         if !checkStatus(show: false) {
             return
         }
-
+        
         let point = recognizer.location(in: bottomeView)
-
+        
         switch recognizer.state {
         case .began:
             touchStart = recognizer.location(in: bottomeView)
@@ -462,7 +515,7 @@ public class BFRecordScreenController: BFBaseViewController {
                     
                 }
             }
-
+            
         case .ended:
             BFLog(1, message: "移动结束 \(beginOnStartBtn)")
             if beginOnStartBtn == true {
@@ -474,7 +527,7 @@ public class BFRecordScreenController: BFBaseViewController {
                     cancleRecord()
                 }
             }
-
+            
         default:
             break
         }
@@ -489,7 +542,7 @@ public class BFRecordScreenController: BFBaseViewController {
             avatarView.isHidden = true
             avatarView.closeCamera()
         }
- 
+        
     }
     
     @objc func drawPin(){
@@ -498,36 +551,34 @@ public class BFRecordScreenController: BFBaseViewController {
     
     //字幕
     @objc func subTitleClick(){
-         BFLog(message: "subTitle Click ")
-//        subtitleView.isHidden = !subtitleView.isHidden
+        BFLog(message: "subTitle Click ")
+        subtitleSettingView.isHidden = !subtitleSettingView.isHidden
         
-        subtitleEditView.isHidden = !subtitleEditView.isHidden
-        subtitleEditView.textView.becomeFirstResponder()
     }
     //声音设置
     @objc func soundSetting(){
         BFLog(message: "设置声音")
-    
+        
     }
     
     @objc func startRecord(){
- 
+        
         BFLog(1, message: "start \(UIControl.Event.touchDown)")
- 
+        
         let point = progressThumV.progressView.contentOffset
         progressThumV.progressView .setContentOffset(point, animated: false)
-
+        
         isRecording = true
         pause()
         
         events.append(WithDrawModel(type: 2, timestamp: self.currentAssetProgress.seconds))
-
+        
         let model = PQVoiceModel()
         model.startTime = self.currentAssetProgress.seconds
         model.volume = 100
-
-//        recorderManager.voiceModel = model
-//        recorderManager.startRecord(index: recordList.count)
+        
+        //        recorderManager.voiceModel = model
+        //        recorderManager.startRecord(index: recordList.count)
         movie?.startProcessing()
         assetPlayer?.volume = 0
         assetPlayer?.play()
@@ -536,31 +587,31 @@ public class BFRecordScreenController: BFBaseViewController {
         if(!avatarView.isHidden){
             avatarView.beginRecord()
         }
- 
+        
         recorderManager.voiceModel = model
         recorderManager.startRecord(index: 1)
-//        movie?.startProcessing()
+        //        movie?.startProcessing()
         assetPlayer?.volume = 0
         assetPlayer?.play()
         
-
+        
         speechTranscriberUtil.delegate = self
         speechTranscriberUtil.startTranscriber()
-       
-
- 
+        
+        
+        
     }
     
     @objc func endRecord(){
         
-      speechTranscriberUtil.endTranscriber()
+        speechTranscriberUtil.endTranscriber()
         playBtn.isSelected = true
         // 存储录音
         isRecording = false
- 
+        
         recorderManager.voiceModel?.endTime = self.currentAssetProgress.seconds
         recorderManager.endRecord()
-
+        
         pause()
         if(!avatarView.isHidden){
             avatarView.endRecord()
@@ -568,7 +619,7 @@ public class BFRecordScreenController: BFBaseViewController {
     }
     
     func cancleRecord(){
-
+        
         isRecording = false
         recorderManager.cancleRecord()
         
@@ -603,7 +654,7 @@ public class BFRecordScreenController: BFBaseViewController {
     }
     
     @objc func changeVoiceAction(){
-//        nextActionHandle?()
+        //        nextActionHandle?()
         pause()
     }
     
@@ -616,13 +667,13 @@ public class BFRecordScreenController: BFBaseViewController {
             play()
         }
     }
-
+    
     @objc func sliderTouchBegan(sender _: UISlider) {
         isDragingProgressSlder = true
         pause()
-
+        
     }
-
+    
     @objc func sliderTouchEnded(sender: UISlider) {
         changeProgress(progress: sender.value)
         isDragingProgressSlder = false
@@ -664,7 +715,7 @@ public class BFRecordScreenController: BFBaseViewController {
         let status = AVCaptureDevice.authorizationStatus(for: .audio)
         switch status {
         case .denied, .restricted:
-
+            
             BFLog(message: "麦克风权限被拒绝,请在设置中打开")
             if show {
                 let remindData = BFBaseModel()
@@ -692,7 +743,7 @@ public class BFRecordScreenController: BFBaseViewController {
         default:
             break
         }
-
+        
         return false
     }
     
@@ -758,7 +809,7 @@ public class BFRecordScreenController: BFBaseViewController {
                             if finished && (self?.isNormalPlaying ?? false) {
                                 self?.recordPlayer?.play()
                                 BFLog(1, message: "录音开始播放 playing, \(second), \(CMTimeGetSeconds(self?.recordPlayer?.currentItem?.duration ?? .zero))")
-
+                                
                             }
                         })
                     }
@@ -770,21 +821,21 @@ public class BFRecordScreenController: BFBaseViewController {
             
         }
         BFLog(1, message: "应当播放:\(shouldPlayRecordIndex), 当前播放:\(currentPlayRecordIndex)")
-//        if let recordedAudio = recordedAudio {
-//
-//
-//            if shouldPlayRecordIndex != currentPlayRecordIndex {
-//                // 设置新的播放资源
-//
-////                self.recordPlayer.delegate = self
-//                self.recordPlayer.play()
-//
-//            } else {
-//                // 更新播放进度
-//                let second = CMTimeGetSeconds(duration) - recordedAudio.startTime
-//                self.recordPlayer.seek(to: CMTime(seconds: second, preferredTimescale: 25), toleranceBefore: CMTime(value: 1, timescale: 1000), toleranceAfter: CMTime(value: 1, timescale: 1000))
-//            }
-//        }
+        //        if let recordedAudio = recordedAudio {
+        //
+        //
+        //            if shouldPlayRecordIndex != currentPlayRecordIndex {
+        //                // 设置新的播放资源
+        //
+        ////                self.recordPlayer.delegate = self
+        //                self.recordPlayer.play()
+        //
+        //            } else {
+        //                // 更新播放进度
+        //                let second = CMTimeGetSeconds(duration) - recordedAudio.startTime
+        //                self.recordPlayer.seek(to: CMTime(seconds: second, preferredTimescale: 25), toleranceBefore: CMTime(value: 1, timescale: 1000), toleranceAfter: CMTime(value: 1, timescale: 1000))
+        //            }
+        //        }
     }
     
     func play(){
@@ -806,7 +857,7 @@ public class BFRecordScreenController: BFBaseViewController {
     func pause(){
         BFLog(1, message: "暂停播放")
         isNormalPlaying = false
-//        movie?.cancelProcessing()
+        //        movie?.cancelProcessing()
         assetPlayer?.pause()
         recordPlayer?.pause()
         
@@ -816,7 +867,7 @@ public class BFRecordScreenController: BFBaseViewController {
     
     func fetchVideo(){
         if self.assets.count > 0 {
-
+            
             currItemModelIndex = 0
             
             for (index, asset) in self.assets.enumerated() {
@@ -832,7 +883,7 @@ public class BFRecordScreenController: BFBaseViewController {
                 options.deliveryMode = .automatic
                 
                 PHImageManager.default().requestPlayerItem(forVideo:asset, options: options, resultHandler: { [weak self] playerItem, info in
-
+                    
                     guard let item = playerItem else {
                         cShowHUB(superView: nil, msg: "视频获取失败")
                         return
@@ -843,24 +894,24 @@ public class BFRecordScreenController: BFBaseViewController {
                     }
                 })
                 
-//                let option = PHImageRequestOptions()
-//                option.isNetworkAccessAllowed = true //允许下载iCloud的图片
-//                option.resizeMode = .fast
-//                option.deliveryMode = .highQualityFormat
-//                PHImageManager.default().requestImage(for: asset,
-//                                               targetSize: self.view.bounds.size,
-//                                              contentMode: .aspectFit,
-//                                                  options: option)
-//                { (image, nil) in
-//                     // 设置首帧/封面
-//                    if image != nil {
-//                        let pic = GPUImagePicture(image: image)
-//                        let filet = GPUImageFilter()
-//                        pic?.addTarget(filet)
-//                        filet.addTarget(self.playView)
-//                        pic?.processImage()
-//                    }
-//                }
+                //                let option = PHImageRequestOptions()
+                //                option.isNetworkAccessAllowed = true //允许下载iCloud的图片
+                //                option.resizeMode = .fast
+                //                option.deliveryMode = .highQualityFormat
+                //                PHImageManager.default().requestImage(for: asset,
+                //                                               targetSize: self.view.bounds.size,
+                //                                              contentMode: .aspectFit,
+                //                                                  options: option)
+                //                { (image, nil) in
+                //                     // 设置首帧/封面
+                //                    if image != nil {
+                //                        let pic = GPUImagePicture(image: image)
+                //                        let filet = GPUImageFilter()
+                //                        pic?.addTarget(filet)
+                //                        filet.addTarget(self.playView)
+                //                        pic?.processImage()
+                //                    }
+                //                }
                 
                 PHCachingImageManager().requestAVAsset(forVideo: asset, options: options, resultHandler: {[weak self] (asset: AVAsset?, audioMix: AVAudioMix?, info) in
                     if let urlasset = asset as? AVURLAsset {
@@ -874,7 +925,7 @@ public class BFRecordScreenController: BFBaseViewController {
                 })
             }
         }
-
+        
     }
     
     func setVideoPlay(item:AVPlayerItem){
@@ -882,9 +933,9 @@ public class BFRecordScreenController: BFBaseViewController {
             cleanMovieTarget()
         }
         movie = GPUImageMovie(playerItem: item)
-//        movie?.runBenchmark = true
+        //        movie?.runBenchmark = true
         movie?.playAtActualSpeed = true
-
+        
         let filter = GPUImageFilter()
         movie?.addTarget(filter)
         filter.addTarget(playView)
@@ -893,14 +944,14 @@ public class BFRecordScreenController: BFBaseViewController {
     }
     
     func setAudioPlay(item:AVPlayerItem){
-
+        
         if let playItem = assetPlayer?.currentItem {
             NotificationCenter.default.removeObserver(self, name: .AVPlayerItemDidPlayToEndTime, object: playItem)
             assetPlayer?.replaceCurrentItem(with: item)
         }else {
             assetPlayer = AVPlayer(playerItem: item)
             avplayerTimeObserver = assetPlayer?.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 100), queue: DispatchQueue.global()) {[weak self] time in
-             //    进度监控
+                //    进度监控
                 
                 self?.currentAssetProgress = time
                 BFLog(1, message: "curr:\(CMTimeGetSeconds(time))")
@@ -918,25 +969,25 @@ public class BFRecordScreenController: BFBaseViewController {
                     self?.playRecord(at: time)
                 }
                 
-
+                
             } as? NSKeyValueObservation
         }
-
+        
         
         NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: assetPlayer?.currentItem, queue: .main) { [weak self] notify in
             BFLog(1, message: "AVPlayerItemDidPlayToEndTime = \(notify)")
             self?.isNormalPlaying = false
-//            self?.assetPlayer?.seek(to: CMTime.zero)
-//            self?.progressThumV.progress = 0
+            //            self?.assetPlayer?.seek(to: CMTime.zero)
+            //            self?.progressThumV.progress = 0
             self?.isEndPlay = true
-//            self?.currentPlayRecordIndex = -1
+            //            self?.currentPlayRecordIndex = -1
             if self?.isRecording ?? false {
                 self?.endRecord()
             }
             self?.recordBtn.isHidden = true
         }
     }
-
+    
     
     func cleanMovieTarget(){
         movie?.cancelProcessing()
@@ -959,9 +1010,9 @@ public class BFRecordScreenController: BFBaseViewController {
             DispatchQueue.main.async {[weak self] in
                 self!.progreddL.text = String(format: "%.2f", CMTimeGetSeconds(self!.currentAssetProgress))
             }
-
+            
             assetPlayer!.seek(to: self.currentAssetProgress, toleranceBefore: CMTime(value: 1, timescale: 1000000), toleranceAfter: CMTime(value: 1, timescale: 1000000)) { finished in
-
+                
             }
         }
     }
@@ -974,7 +1025,7 @@ public class BFRecordScreenController: BFBaseViewController {
             sself.progressThumV.progessIndicateBackV.subviews.forEach { vv in
                 vv.removeFromSuperview()
             }
-
+            
             
             if let totalDur = sself.itemModels[sself.currItemModelIndex].baseMaterial?.duration.seconds, totalDur > 0, sself.itemModels[sself.currItemModelIndex].voiceStickers.count > 0 {
                 let width = sself.progressThumV.progessIndicateBackV.width
@@ -1009,34 +1060,29 @@ extension BFRecordScreenController : AVAudioPlayerDelegate {
 }
 
 
- // MARK: - 视图参数
+// MARK: - 语音转文字代理
 extension BFRecordScreenController:PQSpeechTranscriberUtilDelegate{
     
     
     public func eventCallback(_ event: PQSpeechTranscriberUtil, asrResult: String) {
         let dicResult:Dictionary<String,Any>? =  jsonStringToDictionary(asrResult)
-
+        
         let payload = dicResult?["payload"] as? Dictionary<String,Any>
         
         
         BFLog(message: "识别结果:dicResult is \(String(describing: dicResult)) \((payload?["result"])!)")
         DispatchQueue.main.async {
-         
-            let attributedText = NSMutableAttributedString(string: (payload?["result"]) as! String,attributes: [.font: UIFont.systemFont(ofSize: 34),.strokeWidth:-3,.strokeColor:UIColor.orange])
-            self.subtitleLabel.attributedText = attributedText
-        }
-        
-        
-    
-        
-//        BFLog(message: "ui asrResult is \(String(describing: dicResult))  结果为:\(Dictionary<String,Dictionary>dicResult?["payload"]")"
-        
+            
+            self.subtitleLabel.text = ((payload?["result"]) as? String) ?? ""
+            
+            self.setSubtitleStyle(settingModel: self.subtitleSettingView.subtitleSetting)
+            
+            
     
-        
-     
-        
+ 
+        }
         
     }
- 
+    
     
 }