rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

Custom Filter not being applied to preview screen using SCSwipeableFilterView #422

Open anodev17 opened 6 years ago

anodev17 commented 6 years ago

I am trying to apply a custom filter that user may swipe through when using app however when I try & apply custom filter it is not applied to screen, I have tried several different methods & it works successfully in example project, however not in my project. I am using a custom camera to record video then creating AVAsset from the URL. All other filters work except this one. Here is code

override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor.gray asset = AVAsset(url: videoURL)

     var galaxyFilter = SCFilter(ciImage: CIImage(image: UIImage(named: "camera_filter_3")!.alpha(value: 0.5))!)

    filterSwitch.frame = self.view.frame
    filterSwitch.contentMode = .scaleAspectFill
    filterSwitch.filters = [galaxyFilter]

    player.scImageView = filterSwitch
    self.view.addSubview(filterSwitch)

    filterSwitch.translatesAutoresizingMaskIntoConstraints = true

}

then I call the play method here override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated)

  player.setItemBy(asset!)
  player.play()

}