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(camera): resultForVideo uri in iOS13 #533

Conversation

guillem-sopra
Copy link

@guillem-sopra guillem-sopra commented Nov 28, 2019

In iOS 13, videos' uris are not being retrieved properly as this issue describes: #506 (comment)

Closes #506

Platforms affected

iOS

Motivation and Context

This PR aims to solve that bug ir order for the plugin to retrieve the file's uri properly. Full credit for this solution to #506 (comment).

Description

Please see #506 (comment)

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@breautek
Copy link
Contributor

breautek commented Nov 29, 2019

Can you edit the PR to include one of the keywords that signals that this issue closes #506

Github is bit picky, you must be explicit "fixes #issueTag" for example.

https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords

@guillem-sopra
Copy link
Author

Done 👍

@fvadouko
Copy link

fvadouko commented Dec 5, 2019

Please,

How to use this PR in my package. json like : git+https://github.com/apache/cordova-plugin-inappbrowser.git#27fe8ec8d4db84b34700d32c1f1351c9189cb951 ?

@guillem-sopra
Copy link
Author

Can you edit the PR to include one of the keywords that signals that this issue closes #506

Github is bit picky, you must be explicit "fixes #issueTag" for example.

https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords

Hey @breautek am I missing anything else?

@breautek
Copy link
Contributor

breautek commented Dec 9, 2019

@guillem-sopra I'm not very experienced in the ios codebase, nor do I have apple hardware to test so I'm unable to make a code review.

@fvadouko
Copy link

How to use this PR in my package. json like : git+https://github.com/apache/cordova-plugin-inappbrowser.git#27fe8ec8d4db84b34700d32c1f1351c9189cb951 ?

Because, i use ionic cordova to build one of my app to iOS

@guillem-sopra
Copy link
Author

guillem-sopra commented Dec 12, 2019

@guillem-sopra I'm not very experienced in the ios codebase, nor do I have apple hardware to test so I'm unable to make a code review.

😢 How do you usually proceed in cases like this? Is there anybody I can 'enforce' to code-review/test this PR?

@breautek
Copy link
Contributor

breautek commented Dec 12, 2019

@guillem-sopra I'm not very experienced in the ios codebase, nor do I have apple hardware to test so I'm unable to make a code review.

How do you usually proceed in cases like this? Is there anybody I can 'enforce' to code-review/test this PR?

Cordova is entirely volunteer driven so I can't "force" anybody to review a PR.

Copy link

@Yu0614 Yu0614 left a comment

Choose a reason for hiding this comment

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

👍

@fvadouko
Copy link

Anybody to help, please ?

i use ionic cordova to build one of my app to iOS, and the last release not working - no video can upload to my server. And this fix could solve my issue.

Anybody to help, please ?
Or How to use this PR in my package. json like : git+https://github.com/apache/cordova-plugin-inappbrowser.git#27fe8ec8d4db84b34700d32c1f1351c9189cb951 ?

Please !

@rricamar
Copy link

rricamar commented Jan 8, 2020

Hi, any update on this? Ty for any feedback in advance 🙏 😞

@fvadouko
Copy link

Hey,

when will you deliver a new release with this PR ? I, myself, wait for it, for my ionic app.

@rayelward
Copy link

@fvadouko

Anybody to help, please ?
Or How to use this PR in my package. json like : git+https://github.com/apache/cordova-plugin-inappbrowser.git#27fe8ec8d4db84b34700d32c1f1351c9189cb951 ?

Please !

"cordova-plugin-camera": "git+https://github.com/apache/cordova-plugin-camera.git#4cc795c118af8f97f1cfd1076370be01fce00e71"
in my package dependencies is working for me right now to target this specific commit. I'll keep following this PR to see when its released and I can switch back to the master versioned releases... hopefully sometime before iOS 14 comes and breaks something else.

@RHinderiks
Copy link

When will this be merged and released?

sarunyool pushed a commit to sarunyool/cordova-plugin-camera that referenced this pull request Feb 14, 2020
@onatcipli
Copy link

onatcipli commented Feb 14, 2020

#506 @fvadouko you can add a cordova plugin from github repository with the following command

cordova plugin add github_url

for example:

Dont forget to remove old plugin first
cordova plugin remove <plugin>

I just forked the repo from @guillem-sopra (thank you for the PR) then I added a fixed plugin from github repository

Edit

You need to merge this branch changes to your forked repository master, as I do here

cordova plugin add https://github.com/onatcipli/cordova-plugin-camera.git

@wingo7
Copy link

wingo7 commented Mar 12, 2020

Does this work for you, guys? Because I still have a path with trim fragments and after closing, the app video file is not available

@rricamar
Copy link

rricamar commented Mar 12, 2020

Hi @wingo7 , if you read the whole original issue, you'll see that in addition of the plugin source code solution, you'll need also to patch the fileUri after the plugin call:

// Using plugin fork with this PR solution!
let fileUri = await this.camera.getPicture(options); 

// XXX: fix path for file:// protocol in iOS 13
const indexOfFilePrefix = parseInt(fileUri.indexOf('file://'), 10);

if (indexOfFilePrefix === -1) {
    fileUri = `file://${fileUri}`;
}

I hope this help you 👍

Edit: Here it is the original comment: #506 (comment)

@wingo7
Copy link

wingo7 commented Mar 16, 2020

@rricamar the problem was in the other, I've changed code in the wrong place, after changing code by path: 'projectName/platforms/ios/projectName/Plugins/cordova-plugin-camera/CDVCamera.m' it works for me, thanks for replying me.
Hope, my answer help the others, who faced with it

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

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

It's not recommended to use NSHomeDirectory, the proper way of getting documents directory is by using NSDocumentDirectory (it's not a direct replacement, check this to know how to use it )
Also, instead of creating a tmp folder inside Documents folder and copy the file there, you should write the file in NSCachesDirectory

@rricamar
Copy link

As long as I know @guillem-sopra is not working anymore on his previous company, so don't expect any changes on this PR

@guillem-sopra
Copy link
Author

guillem-sopra commented Apr 12, 2020

Look @jcesarmobile man, this is sad. I created this PR 5 months ago, coming form an issue that went unattended for long (with lots of comments of users asking to be fixed and released). I dedicated also hours form my spare time to get the code, test it and create the PR (crediting the original poster). I am not an Objective-C nor Cordova plugin developer, I just wanted to help. Now, 5 moths later, you request changes, which seem to be really simple to implement to an experienced Objective-C developer. As I said, I am not that, nor I have the project's code or the needed devices to test.

I know OSS is frustrating, it relies on developers' good will and people sometimes can be rough with their demands. But I think this is not the case: this issue was absolutely abandoned. IMHO, not attending the issue with the level of activity it had for 5 months can't be considered maintaining a project. If anyone does not have the proper time to do it, its totally understandable, but it should remove himself from the project. If nobody can, then the project must be marked as unmaintained or deprecated.

I'll try to do my best to implement the changes requested, but man, publicly complaining on twitter, where people does not have the context of the situation, omitting that the issue was ignored for months, all due to a thumbs down reaction ... not fair.

@guillem-sopra guillem-sopra force-pushed the fix/camera-result-for-video-url branch from ba2b84e to da71dbb Compare April 12, 2020 13:15
@guillem-sopra guillem-sopra force-pushed the fix/camera-result-for-video-url branch from da71dbb to 7e28e1d Compare April 12, 2020 13:23
@rricamar
Copy link

OK, I've just tried last commit of the PR and it works, for test it:

cordova plugin rm cordova-plugin-camera
cordova plugin add git+https://github.com/guillem-sopra/cordova-plugin-camera\#7e28e1d3456d7f12591983d7c5a70fe9cab2a40c

Tested on an iPad Mini (iOS 13.3.1)

Pls @jcesarmobile check it out again since maybe your request changes won't allow merge, ty 👍

@rricamar
Copy link

Hey @jcesarmobile I saw bfa38fe, does it mean this PR is no longer needed? Hope it gets released soon, ty 👍

@indraraj26
Copy link

indraraj26 commented Jun 23, 2020

any update on this PR?

@mwyld
Copy link

mwyld commented Sep 16, 2020

This issue knocked me out for hours. When will it be merged?

@jcesarmobile
Copy link
Member

this problem is not present on 5.0.0

@wingo7
Copy link

wingo7 commented Oct 23, 2020

@jcesarmobile Thanks, but it doesn't work as expected for ios 14.1, WKWebView mode only, for cordova-ios 4.5.0, or cordova-ios 5.1.1. The problem is that I can't see the image or video after restarting the app.
error in console:
Failed to load resource: file:///var/mobile/Containers/Data/Application/1D939307-4AAE-4821-8E66-A06E70370785/tmp/cdv_photo_001.jpg The requested URL was not found on this server.
Note: file:// has been removed from the file path

@PegasusAwesome
Copy link

PegasusAwesome commented Nov 6, 2020

this problem is not present on 5.0.0

Just tested this with 5.0.0, and this problem seems still very much present.

In 5.0.0 we still see an invalid non proprietary FILE_URI with no access to work with, like:
file:///private/var/mobile/Containers/Data/PluginKitPlugin/4D7CFBAC-1D1E-4CCD-8F79-5C0E3FC0E2C8/tmp/trim.F82BBDFE-D013-4122-942D-45459045E3A5.MOV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS13 file_uri error picking video from gallery