Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only apply filter if filter is set #1360

Merged
merged 2 commits into from
Dec 13, 2018
Merged

Conversation

nickgzzjr
Copy link
Contributor

This is an attempt to fix Issue 1348

_playerItem.videoComposition = [AVVideoComposition
videoCompositionWithAsset:asset
applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *_Nonnull request) {
if (filter != nil) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, need to test for an empty filter name too. Having set no filter, I get "" here, not nil

@cobarx
Copy link
Contributor

cobarx commented Dec 13, 2018

I've refactored the code so that we handle both empty string and nil values. I also made it keep track of whether we've initialized the filter or not so that you can turn off the filter after you've applied a filter. I believe this was lost in the new PR.

@cobarx cobarx merged commit e5bada9 into TheWidlarzGroup:master Dec 13, 2018
@niklassaers
Copy link
Contributor

👍 Thank you. 🙏

@nickgzzjr
Copy link
Contributor Author

@niklassaers I had specifically made it to test filter != nil only and not "" because on some videos (with rotated orientations) the transformation matrix does not get applied correctly to the videoComposition if doesn't start playing with a filter. I think what @cobarx had suggested in Issue 1348 to add filterEnabled is the way to go. I'll try to get a pull request in later this evening.

beauner69 pushed a commit to beauner69/react-native-video that referenced this pull request Oct 10, 2019
Only apply filter if filter is set

(rebased from commit e5bada9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS: RCTVideo setSrc: will block mainthread for long due to RCT setFilter:
3 participants