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

Sample App : - GLView Frame Size required to be the Frame size of the video? #372

Open nikhildhamsaniya opened 7 years ago

nikhildhamsaniya commented 7 years ago
if ([[NSProcessInfo processInfo] activeProcessorCount] > 1) {
    self.filterSwitcherView.contentMode = UIViewContentModeScaleAspectFill;

    SCFilter *emptyFilter = [SCFilter emptyFilter];
    emptyFilter.name = @"#nofilter";

    self.filterSwitcherView.filters = @[
                                             emptyFilter,
                                             [SCFilter filterWithCIFilterName:@"CIPhotoEffectNoir"],
                                             [SCFilter filterWithCIFilterName:@"CIPhotoEffectChrome"],
                                             [SCFilter filterWithCIFilterName:@"CIPhotoEffectInstant"],
                                             [SCFilter filterWithCIFilterName:@"CIPhotoEffectTonal"],
                                             [SCFilter filterWithCIFilterName:@"CIPhotoEffectFade"],
                                             // Adding a filter created using CoreImageShop
                                             [SCFilter filterWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"a_filter" withExtension:@"cisf"]],
                                             [self createAnimatedFilter]
                                             ];
    _player.SCImageView = self.filterSwitcherView;
    [self.filterSwitcherView addObserver:self forKeyPath:@"selectedFilter" options:NSKeyValueObservingOptionNew context:nil];
} else {
    SCVideoPlayerView *playerView = [[SCVideoPlayerView alloc] initWithPlayer:_player];
    playerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    playerView.frame = self.filterSwitcherView.frame;
    playerView.autoresizingMask = self.filterSwitcherView.autoresizingMask;
    [self.filterSwitcherView.superview insertSubview:playerView aboveSubview:self.filterSwitcherView];
    [self.filterSwitcherView removeFromSuperview];
}

I am not sure how does this if condition execute. I want to apply crop function to the video for that i need videorect via avplayerlayer Thanks in advance.