0 Replies
      Latest reply on Aug 12, 2019 10:49 AM by Devgeek
      Devgeek Level 1 Level 1 (0 points)

        I apply real time effects using CoreImage to video that is played using AVPlayer. The problem is when the player is paused, filters are not applied if you tweak filter parameters using slider.

         

        let videoComposition = AVMutableVideoComposition(asset: asset, applyingCIFiltersWithHandler: {[weak self] request in
        
                // Clamp to avoid blurring transparent pixels at the image edges
                let source = request.sourceImage.clampedToExtent()
                let output:CIImage
        
                if let filteredOutput = self?.runFilters(source, filters: array)?.cropped(to: request.sourceImage.extent) {
                     output = filteredOutput
                 } else {
                     output = source
                 }
        
        
                // Provide the filter output to the composition
                request.finish(with: output, context: nil)
            })

         

        I used this workaround to forcibly apply effects on paused player that worked only till iOS 12.4 unfortunately:

         

        if self.moviePlayerView.player?.rate == 0.0 {
                self.moviePlayerView.player?.currentItem?.videoComposition = self.moviePlayerView.player?.currentItem?.videoComposition
            }

        I am not sure what to do in iOS 13, how do I force apply effects on paused player?