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

feat(ios): Add feature to convert videos to MP4 #2094

Merged
merged 2 commits into from
Mar 13, 2023
Merged

Conversation

Johan-dutoit
Copy link
Collaborator

@Johan-dutoit Johan-dutoit commented Mar 13, 2023

This allows videos to be converted to MP4 on iOS. For now the quality is set to highest, which may affect performance.

Non-MP4 video (no conversion)
image

MP4 video (same video as above, with conversion)
image

@Johan-dutoit Johan-dutoit merged commit 433d975 into main Mar 13, 2023
Johan-dutoit pushed a commit that referenced this pull request Mar 13, 2023
# [5.3.0](v5.2.0...v5.3.0) (2023-03-13)

### Features

* **ios:** Add feature to convert videos to MP4 ([#2094](#2094)) ([433d975](433d975))
@Johan-dutoit
Copy link
Collaborator Author

🎉 This PR is included in version 5.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ratz6
Copy link
Contributor

ratz6 commented May 30, 2023

@Johan-dutoit @marcshilling @dwosk @MakarovAleksey

can we add this condition to run if the file extension is not .mp4 ?

It's running even if the fileType is .mp4 when formatAsMp4 is passed as true ..
so the copying to temp directory is happening twice for both .mov as well as .mp4 video which is causing a certain delay to throw the callback response

@Johan-dutoit
Copy link
Collaborator Author

Good point @ratz6 , can you submit a PR please to fix it?

@ratz6
Copy link
Contributor

ratz6 commented May 30, 2023

Good point @ratz6 , can you submit a PR please to fix it?

@Johan-dutoit @marcshilling @dwosk @MakarovAleksey is this ok ?
#2133
Haven't had a chance to get my hands dirty with objective C. Please don't mind :)

@ratz6
Copy link
Contributor

ratz6 commented May 30, 2023

@Johan-dutoit there are few cases not handled while formattingToMp4 , I'm fixing it in swift but pls don't ask me to raise PR in obj c .. Is there a scope to migrate whole package to swift ? >

  1. Unable to read files with spaces. in the device. Convert spaces from fileName into "" when copying the file into the app's temp memory ..
    Did this in swift >

var temporaryFileURL = temporaryDirectoryURL.appendingPathComponent(String(url.lastPathComponent!.filter { !" \n\t\r".contains($0) }) )

response["fileName"] = String((fileUrl?.lastPathComponent.filter { !" \n\t\r".contains($0) })!)

  1. If I don't pass formatAsMp4 as true , the the file is being copied to temp folder by taking the path which ends with fileName (coming from device) as there is no UUID appended here.. this file is already deleted as the newly picked file will also go to the same place.. So unable to pick the same file twice until I go back and re initalize the component
image
  1. While picking .mov videos with formatAsMp4, the mov video is being copied to app storage and the resultant .mp4 video is also saved in the app storage..
    As we are sending the .mp4 file to react native, I'm able to unlink that file using RNFS .. But how do I delete the .mov video from app's temp storage ?

cc @marcshilling @dwosk @MakarovAleksey

@Johan-dutoit Johan-dutoit deleted the formatAsMp4 branch June 20, 2023 09:05
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