Skip to content

Commit

Permalink
Small code cleanup to setFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
cobarx committed Dec 20, 2018
1 parent c2d9fb4 commit f401c6a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions ios/Video/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -1288,17 +1288,13 @@ - (void)setFilter:(NSString *)filterName {
return;
} else if ([[_source objectForKey:@"uri"] rangeOfString:@"m3u8"].location != NSNotFound) {
return; // filters don't work for HLS... return
}

AVAsset *asset = _playerItem.asset;

if (!asset) {
} else if (!_playerItem.asset) {
return;
}

CIFilter *filter = [CIFilter filterWithName:filterName];
_playerItem.videoComposition = [AVVideoComposition
videoCompositionWithAsset:asset
videoCompositionWithAsset:_playerItem.asset
applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *_Nonnull request) {
if (filter == nil) {
[request finishWithImage:request.sourceImage context:nil];
Expand Down Expand Up @@ -1475,4 +1471,4 @@ - (NSString *)cacheDirectoryPath {
return array[0];
}

@end
@end

0 comments on commit f401c6a

Please sign in to comment.