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

fix(android): improve video dimensions extraction #2139

Merged

Conversation

renchap
Copy link
Contributor

@renchap renchap commented Jun 7, 2023

MediaMetadataRetriever can directly return the video dimensions, no need to extract a frame for this.

Motivation (required)

I was troubleshooting #2138 and noticed that if I commented the dimension-extraction code, it would work fine with 30+ videos.

I am not familiar with Android, but a quick search showed that the video dimensions can be extracted like the other metadata. Switching to the metadata extractor fixed the ANRs I reported in the linked issue.

I am not sure why it was done this way initially this way, maybe @lukebrandonfarrell can provide some context (author of the initial #1891 PR introducing this code)

Test Plan (required)

I tested this using the example app, selection up to 40 videos on my Android 13 phone. This returned the correct dimensions for the files, and did not crash nor cause an ANR.

I did not test in earlier Android, as I dont have any of those on hand.

`MediaMetadataRetriever` can directly return the video dimensions, no need to extract a frame for this.
@Johan-dutoit Johan-dutoit merged commit 7aca9d3 into react-native-image-picker:main Jun 12, 2023
Johan-dutoit pushed a commit that referenced this pull request Jun 12, 2023
## [5.4.2](v5.4.1...v5.4.2) (2023-06-12)

### Bug Fixes

* **android:** improve video dimensions extraction ([#2139](#2139)) ([7aca9d3](7aca9d3))
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 5.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@renchap renchap deleted the better-video-size branch June 12, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants