Kaynağa Gözat

1.merge commnity

wenweiwei 3 yıl önce
ebeveyn
işleme
0639d448ba

+ 64 - 61
BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

@@ -14,7 +14,7 @@ import UIKit
 open class PQImageFilter: PQBaseFilter {
     // 图片纹理
     var imageTexture: GLuint = 0
-
+    var imageVertexBuffer: GLuint = 0
     var mSticker: PQEditVisionTrackMaterialsModel?
     var newImage: UIImage?
     deinit {
@@ -25,7 +25,10 @@ open class PQImageFilter: PQBaseFilter {
             glDeleteTextures(1, &imageTexture)
             imageTexture = 0
         }
-        
+        if imageVertexBuffer != 0 {
+            PQGPUImageTools.deleteVBO(imageVertexBuffer)
+            imageVertexBuffer = 0
+        }
     }
 
     init(sticker: PQEditVisionTrackMaterialsModel, isExport: Bool = true, showUISize: CGSize = .zero) {
@@ -37,11 +40,10 @@ open class PQImageFilter: PQBaseFilter {
             BFLog(2, message: "图片数据为空,创建失败")
             return
         }
-//        print("mSticker path : \(String(describing: mSticker!.locationPath))")
         newImage = UIImage(contentsOfFile: documensDirectory + sticker.locationPath)
-        //try find image file frome in BFFramework bundle
-        if(newImage == nil){
-            newImage = UIImage.moduleImage(named: sticker.locationPath, moduleName: "BFFramework",isAssets: false)
+        // try find image file frome in BFFramework bundle
+        if newImage == nil {
+            newImage = UIImage.moduleImage(named: sticker.locationPath, moduleName: "BFFramework", isAssets: false)
         }
         // 如果是预览时 对原图进行缩放处理
         if !isExport {
@@ -49,7 +51,6 @@ open class PQImageFilter: PQBaseFilter {
             newImage = newImage?.nx_scaleWithMaxLength(maxLength: CGFloat(maxLength * UIScreen.main.scale))
 
             BFLog(message: "newImage is \(newImage?.size.width ?? 0) \(newImage?.size.height ?? 0)")
- 
         }
 
         autoreleasepool {
@@ -68,24 +69,22 @@ open class PQImageFilter: PQBaseFilter {
         if newImage?.cgImage != nil {
             BFLog(message: "提前加载图片。。。。timelineIn : \(String(describing: mSticker?.timelineIn)) timelineOut :\(String(describing: mSticker?.timelineOut)) \(String(describing: mSticker?.locationPath))")
 
-//            imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
+            //            imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
 
         } else { BFLog(2, message: "image filter init error image data is nil!") }
-        
-        
+
         // 保证是16的公倍数
-        let aptImageSize =  NXAVUtil.aptSize(newImage?.size ?? CGSize.zero)
-        if (!__CGSizeEqualToSize(aptImageSize, (newImage?.size ?? CGSize.zero)))
-        {
-            BFLog(2, message: "原图大小宽度不是16的倍数 \(newImage?.size ?? CGSize.zero)")
-            newImage = newImage?.nx_scaleToSize(size: aptImageSize)
-            BFLog(2, message: "归16后大小 \(newImage?.size ?? CGSize.zero)")
+        let aptImageSize = NXAVUtil.aptSize(newImage?.size ?? CGSize.zero)
+        if !__CGSizeEqualToSize(aptImageSize, newImage?.size ?? CGSize.zero) {
+            BFLog(2, message: "原图大小宽度不是16的倍数 \(newImage!.size)")
+            //            newImage = newImage?.nx_scaleToSize(size: aptImageSize)
+            BFLog(2, message: "归16后大小 \(newImage!.size)")
         }
     }
 
-//    override public func newFramebufferAvailable(_ framebuffer: Framebuffer, fromSourceIndex: UInt) {
-//        super.newFramebufferAvailable(framebuffer, fromSourceIndex: fromSourceIndex)
-//
+    //    override public func newFramebufferAvailable(_ framebuffer: Framebuffer, fromSourceIndex: UInt) {
+    //        super.newFramebufferAvailable(framebuffer, fromSourceIndex: fromSourceIndex)
+    //
     ////        let currTime = CMTimeGetSeconds(CMTime(value: framebuffer.timingStyle.timestamp!.value, timescale: framebuffer.timingStyle.timestamp!.timescale))
     ////
     ////        if mSticker!.timelineIn != 0, currTime >= mSticker!.timelineIn, currTime <= mSticker!.timelineOut, imageTexture == 0 {
@@ -93,13 +92,13 @@ open class PQImageFilter: PQBaseFilter {
     //////                imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
     ////            } else { BFLog(message: "image filter init error image data is nil!") }
     ////        }
-//    }
+    //    }
 
-    open override func renderFrame() {
+    override open func renderFrame() {
         let inputFramebuffer: Framebuffer = inputFramebuffers[0]!
         let inputSize = inputFramebuffer.sizeForTargetOrientation(.portrait)
 
-//        print("renderFrame timestamp is \(inputFramebuffer.timingStyle)")
+        //        print("renderFrame timestamp is \(inputFramebuffer.timingStyle)")
 
         let currTime = CMTimeGetSeconds(CMTime(value: inputFramebuffer.timingStyle.timestamp!.value, timescale: inputFramebuffer.timingStyle.timestamp!.timescale))
 
@@ -122,49 +121,53 @@ open class PQImageFilter: PQBaseFilter {
         BFLog(2, message: " image filter 当前时间: \(currTime) \(newImage!.size)")
 
         if currTime >= mSticker!.timelineIn && currTime <= mSticker!.timelineOut {
-        BFLog(2, message: " 显示图片当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  \(String(describing: newImage?.size))")
-        // 取纹理坐标
-        var textureCoordinates = PQGPUImageTools.getTextureCoordinates(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
+            BFLog(2, message: " 显示图片当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  \(String(describing: newImage?.size))")
+            // 取纹理坐标
+            var textureCoordinates = PQGPUImageTools.getTextureCoordinates(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
 
-        BFLog(2, message: "textureCoordinates is \(textureCoordinates) image size :\(newImage!.size ) cannvasSize:\(inputSize)  files path is \(mSticker?.locationPath)")
+            BFLog(2, message: "textureCoordinates is \(textureCoordinates) image size :\(newImage!.size) cannvasSize:\(inputSize)  files path is \(mSticker?.locationPath)")
 
-        // imageTexture 有可能被析构导致黑屏
-        if imageTexture == 0 && newImage?.cgImage != nil {
-            BFLog(2, message: "imageTexture is error !!!!!重新创建")
-            imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
-        }
+            // imageTexture 有可能被析构导致黑屏
+            if imageTexture == 0 && newImage?.cgImage != nil {
+                BFLog(2, message: "imageTexture is error !!!!!重新创建")
+                imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
+            }
 
-        
-        //如果设置过大小位置,使用设置值,比如水印
-        if(stickerInfo?.materialPosition?.width != 0){
-           textureCoordinates = [
-                0.0, 0.0, // 1 bottom left
-                1.0, 0.0, // 2 bottom right
-                0.0, 1.0, // 3 top left
-                1.0, 1.0, // 4 top right
-            ]
-        }
-        
-        let texturePropertiesimagetwo = InputTextureProperties(textureCoordinates: textureCoordinates, texture: imageTexture)
-
-        var verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
-        
-        //如果设置过大小位置,使用设置值,比如水印
-        if(stickerInfo?.materialPosition?.width != 0){
-            verticesPoint = PQGPUImageTools.computeVertices(viewSize: CGSize.init(width: CGFloat(inputSize.width), height: CGFloat(inputSize.height)), _bounds: CGRect.init(x: stickerInfo?.materialPosition?.x ?? 0, y:  stickerInfo?.materialPosition?.y ?? 0, width: stickerInfo?.materialPosition?.width ?? 0, height: stickerInfo?.materialPosition?.height ?? 0))
-        }
-        
-        // 设置融合模式支持 alpha
-        glEnable(GLenum(GL_DEPTH_TEST))
-        glEnable(GLenum(GL_BLEND))
-        glBlendFunc(GLenum(GL_SRC_ALPHA), GLenum(GL_ONE_MINUS_SRC_ALPHA))
-        
-        renderQuadWithShader(shader,
-                             uniformSettings: uniformSettings,
-                             vertexBufferObject: PQGPUImageTools.NXGenerateVBO(for: verticesPoint),
-                             
-                             inputTextures: [texturePropertiesimagetwo])
+            // 如果设置过大小位置,使用设置值,比如水印
+            if stickerInfo?.materialPosition?.width != 0 {
+                textureCoordinates = [
+                    0.0, 0.0, // 1 bottom left
+                    1.0, 0.0, // 2 bottom right
+                    0.0, 1.0, // 3 top left
+                    1.0, 1.0, // 4 top right
+                ]
+            }
+
+            let texturePropertiesimagetwo = InputTextureProperties(textureCoordinates: textureCoordinates, texture: imageTexture)
+
+            var verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
+
+            // 如果设置过大小位置,使用设置值,比如水印
+            if stickerInfo?.materialPosition?.width != 0 {
+                verticesPoint = PQGPUImageTools.computeVertices(viewSize: CGSize(width: CGFloat(inputSize.width), height: CGFloat(inputSize.height)), _bounds: CGRect(x: stickerInfo?.materialPosition?.x ?? 0, y: stickerInfo?.materialPosition?.y ?? 0, width: stickerInfo?.materialPosition?.width ?? 0, height: stickerInfo?.materialPosition?.height ?? 0))
+            }
+
+            // 设置融合模式支持 alpha
+            glEnable(GLenum(GL_DEPTH_TEST))
+            glEnable(GLenum(GL_BLEND))
+            glBlendFunc(GLenum(GL_SRC_ALPHA), GLenum(GL_ONE_MINUS_SRC_ALPHA))
+
+            imageVertexBuffer = PQGPUImageTools.NXGenerateVBO(for: verticesPoint)
+
+            renderQuadWithShader(shader,
+                                 uniformSettings: uniformSettings,
+                                 vertexBufferObject: imageVertexBuffer, inputTextures: [texturePropertiesimagetwo])
             releaseIncomingFramebuffers()
+
+            if imageVertexBuffer != 0 {
+                PQGPUImageTools.deleteVBO(imageVertexBuffer)
+                imageVertexBuffer = 0
+            }
         }
     }
 }

+ 5 - 1
BFFramework/Classes/PQGPUImage/akfilters/Tools/PQCompositionExporter.swift

@@ -166,13 +166,14 @@ public class PQCompositionExporter {
     }
     
  
-   public  func  findShowStikcer(currTime:Float64)  {
+    public  func  findShowStikcer(currTime:Float64)  {
          
         if(mStickers?.count ?? 0 == 0){
             BFLog(message: "mStickers data is error")
             return
         }
         var currentSticker:PQEditVisionTrackMaterialsModel?
+       
         for sticker in mStickers! {
             BFLog(message: "sticker in \(sticker.timelineIn) out \(sticker.timelineOut)  currTime is \(currTime)")
             if(sticker.timelineIn <= currTime && sticker.timelineOut >= currTime){
@@ -338,6 +339,9 @@ public class PQCompositionExporter {
         input?.cancel()
         output?.assetWriter.cancelWriting()
         output?.finishRecording()
+        
+        input?.removeAllTargets()
+      
     }
 
     public func handleCaption(for asset: AVAsset) {

+ 45 - 26
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -749,7 +749,7 @@ class PQStuckPointEditerController: PQBaseViewController {
             UIApplication.shared.isIdleTimerDisabled = false
         }
         musicNameLab.stop()
-        playerView.pause()
+        playerView.stop()
 
         musicEditBGView.pausePlayer()
         PQNotification.removeObserver(self)
@@ -1122,11 +1122,7 @@ class PQStuckPointEditerController: PQBaseViewController {
 
         let beginTime = Date()
         dealParameter(model: currentCreateStickersModel)
-        if finallyStuckPoints.count < 2 {
-            cShowHUB(superView: nil, msg: "音乐出错,请重新选择音乐")
-            self.navigationController?.popViewController(animated: true)
-            return
-        }
+        
         // 更新裁剪时间条的的ui数据
         stuckPointCuttingView.videoDuration = max(CGFloat(finallyUserAudioTime), CGFloat(finallyStuckPoints.last!))
         let counn = (stuckPointMusicData?.rhythmSdata[0].pointTimes.count)! - 2
@@ -1548,9 +1544,9 @@ extension PQStuckPointEditerController {
         }
         stuckPoints.insert(Float(stuckPointMusicData?.startTime ?? 0), at: 0)
 
-        for point in stuckPoints {
-            BFLog(message: "有 start end 计算后的卡点数\(point)")
-        }
+//        for point in stuckPoints {
+//            BFLog(message: "有 start end 计算后的卡点数\(point)")
+//        }
 
         BFLog(message: "处理节奏后 stuckPoints count is \(stuckPoints.count) seed \(seed), start time:\(stuckPoints.first ?? 0.0),end time:\(stuckPoints.last ?? 0.0) 总时长为:\((stuckPoints.last ?? 0.0) - (stuckPoints.first ?? 0.0))")
 
@@ -1747,11 +1743,12 @@ extension PQStuckPointEditerController {
 
             break
         }
+        
         // 拼接图片所使用的时长.选择一组图片 按图片数量计算卡点的总时长
         if selectedImageDataCount > 0 {
             clipPoint(clipNum: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
         }
-
+        
         // 全是图片时数组里放着的一定都是图片的使用的卡点
         // 定义一次循环的总时长
         var oneSelectImageDuration: Float = 0.0
@@ -1786,6 +1783,12 @@ extension PQStuckPointEditerController {
             }
         }
         
+        if finallyStuckPoints.count < 2 {
+            cShowHUB(superView: nil, msg: "视频资源导入失败,请重新选择!!")
+            exportResourceFailed()
+            return
+        }
+        
         // 设置速度选择的位置
         if speedSettingView.viewType == 1 {
             speedSettingView.setSelectItem(index: lastSpeedSelectIndex, isSettingPlayer: false)
@@ -1860,7 +1863,7 @@ extension PQStuckPointEditerController {
                     self?.synchroMarskView.removeMarskView()
                     cShowHUB(superView: nil, msg: "音乐信息加载失败,请重新选择音乐")
 //                    PQUploadRemindView.showUploadRemindView(title: nil, attributedTitle: NSAttributedString(string: "加载音乐失败,请重新选择音乐"), summary: "", confirmTitle: nil) { [weak self] _, _ in
-//                        self?.navigationController?.popViewController(animated: true)
+                        self?.navigationController?.popViewController(animated: true)
 //                    }
                 }
             }
@@ -1879,6 +1882,7 @@ extension PQStuckPointEditerController {
             exportSession.cancelExport()
         }
         var isHaveVideo: Bool = false
+        var failedExprot: Bool = false
         if selectedMetarialData != nil, (selectedMetarialData?.count ?? 0) > 0 {
             if synchroMarskView.superview == nil {
                 UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
@@ -1914,23 +1918,26 @@ extension PQStuckPointEditerController {
                                         BFLog(message: "导出相册视频-error == \(error)")
                                     }
                                 }
+                                let curr = Date()
+                                let assetResources = PHAssetResource.assetResources(for: photo.asset!)
+                                if let rsc = assetResources.first(where: { res in
+                                    res.type == .video  || res.type == .pairedVideo
+                                }) {
+                                    PHAssetResourceManager.default().writeData(for: rsc, toFile: URL(fileURLWithPath: outFilePath), options: nil) { error in
+                                        if error == nil {
+                                            BFLog(message: "导出视频相exportAsynchronously \(String(describing: outFilePath)) \(Date().timeIntervalSince(curr))")
+                                            tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
+                                        }else{
+                                            failedExprot = true
+                                            BFLog(message: "导出视频相exportAsynchro faile")
+                                        }
+                                        dispatchGroup.leave()
+                                    }
 
-                                do {
-                                    try FileManager.default.copyItem(atPath: fileName.replacingOccurrences(of: "file:///", with: ""), toPath: outFilePath)
-                                    print("Success to copy file.")
-                                } catch {
-                                    print("Failed to copy file.")
+                                }else {
+                                    BFLog(message: "导出视频相exportAsynchro faile")
+                                    dispatchGroup.leave()
                                 }
-
-                                tempPhoto?.locationPath = outFilePath.replacingOccurrences(of: documensDirectory, with: "")
-                                BFLog(message: "导出视频相册地址为 \(String(describing: tempPhoto?.locationPath))")
-
-                                dispatchGroup.leave()
-                            }
-                        }else {
-                            // 结束loading动画
-                            DispatchQueue.main.async {
-                                self.synchroMarskView.removeMarskView()
                             }
                         }
                     }
@@ -1938,6 +1945,11 @@ extension PQStuckPointEditerController {
             }
 
             dispatchGroup.notify(queue: DispatchQueue.main) { [weak self] in
+                if failedExprot {
+                    cShowHUB(superView: nil, msg: "视频导入失败,请返回重试")
+                    self?.exportResourceFailed()
+                    return
+                }
                 self?.isExportVideosSuccess = true
                 BFLog(message: "所有相册视频导出成功")
                 // 处理所有数据完成
@@ -1955,6 +1967,13 @@ extension PQStuckPointEditerController {
             }
         }
     }
+    
+    func exportResourceFailed(){
+        DispatchQueue.main.async {
+            self.synchroMarskView.removeMarskView()
+            self.navigationController?.popViewController(animated: true)
+        }
+    }
 
     /// 处理所有数据完成
     /// - Returns: <#description#>

+ 5 - 5
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMusicContentController.swift

@@ -67,14 +67,14 @@ class PQStuckPointMusicContentController: PQBaseViewController {
         }
         // 延迟scrollView上子视图的响应,所以当直接拖动UISlider时,如果此时touch时间在150ms以内,UIScrollView会认为是拖动自己,从而拦截了event,导致UISlider接收不到滑动的event
         collectionView.delaysContentTouches = false
-        collectionView.addRefreshView (type:.REFRESH_TYPE_FOOTER) {[weak self] isRefresh in
+        collectionView.addRefreshView (type:.REFRESH_TYPE_FOOTER) {[weak self, weak collectionView] isRefresh in
             if !isRefresh && self?.contentType != .catagery{
                 // 请求一下加载更多
                 if self?.refreshHandle != nil {
                     self?.refreshHandle!(isRefresh, self?.contentType ?? .catagery)
                 }
             }else{
-                collectionView.mj_footer?.endRefreshing()
+                collectionView?.mj_footer?.endRefreshing()
             }
         }
         return collectionView
@@ -245,10 +245,10 @@ extension PQStuckPointMusicContentController: UICollectionViewDelegate, UICollec
 
     func collectionView(_ collectionView: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
         let itemData: Any = itemList[indexPath.item]
-        if itemData is ([PQStuckPointMusicTagsModel], ([UICollectionViewLayoutAttributes], CGFloat)) {
-            let height: CGFloat = ((itemData as? ([PQStuckPointMusicTagsModel], ([UICollectionViewLayoutAttributes], CGFloat)))?.0.count ?? 0) > 0 ? (((itemData as? ([PQStuckPointMusicTagsModel], ([UICollectionViewLayoutAttributes], CGFloat)))?.1.1 ?? 0) + 35) : 0
+        if let sul = itemData as? ([PQStuckPointMusicTagsModel], ([UICollectionViewLayoutAttributes], CGFloat)) {
+            let height: CGFloat = (sul.0.count > 0) ? (sul.1.1  + 35) : 0
             return CGSize(width: collectionView.frame.width, height: height)
-        } else if itemData is PQEmptyModel {
+        }else if itemData is PQEmptyModel {
             return CGSize(width: collectionView.frame.width, height: 290)
         } else {
             return CGSize(width: collectionView.frame.width, height: cellHight)

+ 2 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -702,9 +702,7 @@ class PQStuckPointPublicController: PQBaseViewController {
             endMovieExporter.cancel()
         }
  
-        exporter?.input?.removeAllTargets()
-        watermarkMovieExporter?.input?.removeAllTargets()
-        endMovieExporter?.input?.removeAllTargets()
+     
         avPlayer.pause()
         avPlayer.replaceCurrentItem(with: nil)
         // 点击上报:返回按钮
@@ -868,6 +866,7 @@ extension PQStuckPointPublicController {
             }else{
                 cShowHUB(superView: self?.view, msg: "合成失败请重试。")
             }
+            
         }
     }
 

+ 16 - 20
BFFramework/Classes/Stuckpoint/View/PQStuckPointLoadingView.swift

@@ -12,20 +12,15 @@ import BFCommonKit
 
 class PQStuckPointLoadingView: UIView {
     var cancelHandle: ((_ sender: UIButton) -> Void)?
+    
     /// 同步进度显示
-    lazy var loadingView: UIImageView = {
-        let loadingView = UIImageView()
-        loadingView.tintColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
-        loadingView.kf.setImage(with: URL(fileURLWithPath: Bundle.main.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
-//        let data = try? Data(contentsOf: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
-//        if data != nil {
-//            PQPHAssetVideoParaseUtil.parasGIFImage(data: data!, isRenderingColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)) { _, images, duration in
-//                loadingView.displayGIF(data: nil, images: images, repeatCount: .max, duration: duration ?? 2)
-//            }
-//        }
-        return loadingView
+    lazy var loadingView: AnimatedImageView = {
+        let videoLoadingView = AnimatedImageView()
+        videoLoadingView.kf.setImage(with: URL(fileURLWithPath: Bundle.main.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
+        videoLoadingView.stopAnimating()
+        return videoLoadingView
     }()
-
+ 
     lazy var navBarLeftBtn: UIButton = {
         let navBarLeftBtn = UIButton(type: .custom)
         navBarLeftBtn.frame = CGRect(x: 0, y: cDevice_iPhoneStatusBarHei, width: cDefaultMargin * 4, height: cDefaultMargin * 4)
@@ -43,6 +38,7 @@ class PQStuckPointLoadingView: UIView {
         addSubViews()
         addLayout()
         
+        loadingView.startAnimating()
     }
     
     required init?(coder _: NSCoder) {
@@ -75,21 +71,21 @@ class PQStuckPointLoadingView: UIView {
         if self.superview != nil {
             return
         }
-        UIApplication.shared.keyWindow?.addSubview(self)
-        let data = try? Data(contentsOf: URL(fileURLWithPath: currentBundlePath()!.path(forResource: "stuckPoint_edit_loading", ofType: ".gif")!))
-        if data != nil {
-            PQPHAssetVideoParaseUtil.parasGIFImage(data: data!, isRenderingColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)) { _, images, duration in
-                self.loadingView.displayGIF(data: nil, images: images, repeatCount: .max, duration: duration ?? 2)
-            }
-        }
+ 
     }
 
     /// 移除视图
     /// - Returns: <#description#>
     func removeMarskView() {
+        loadingView.stopAnimating()
+        loadingView.layer.removeAllAnimations()
+        loadingView.removeFromSuperview()
+     
         if self.superview != nil {
             removeFromSuperview()            
         }
+      
+        BFLog(message: "removeMarskViewremoveMarskViewremoveMarskViewremoveMarskView")
     }
 
     @objc func cancelDownload(sender: UIButton) {
@@ -100,6 +96,6 @@ class PQStuckPointLoadingView: UIView {
     }
 
     deinit {
-        BFLog(message: "销毁加载中视图")
+        BFLog(message: "销毁加载中视图1111111")
     }
 }

+ 1 - 0
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -725,6 +725,7 @@ public extension PQGPUImagePlayerView {
         //            return
         //        }
 
+        movie?.removeAllTargets()
         movie?.cancel()
         speaker?.cancel()
         status = .stop