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

Optmization stopped to work on iOS #3

Open
jsfan3 opened this issue Mar 30, 2020 · 2 comments
Open

Optmization stopped to work on iOS #3

jsfan3 opened this issue Mar 30, 2020 · 2 comments

Comments

@jsfan3
Copy link
Owner

jsfan3 commented Mar 30, 2020

For unknown reasons, both on iOS12 and iOS13, both with Xcode 10 and Xcode 11, the optimization stopped to work. It still works on Android.

The odd fact is that there are no changes of code of this cn1lib. Six months ago it worked correctly with iOS12 + Xcode10. Now the use of ios.xcode_version=10.1 doesn't help. The other functionalities of library (video duration, video dimension, bitrate, etc.) still work on iOS.

Log using the example code in the README:

EDT] 0:0:6,867 - VideoEditingCallbacks -> Called setOptimizedVideoCallback for inputVideoFile: trim.ACFC6F6D-B574-4898-B2CE-2C1D81BDA6BA.MOV
[EDT] 0:0:6,867 - VideoEditingCallbacks -> Called setVideoErrorCallback for inputVideoFile: trim.ACFC6F6D-B574-4898-B2CE-2C1D81BDA6BA.MOV
[EDT] 0:0:6,888 - VideoOptimizer native code -> Called iOS native code, method "optimizeVideoForUpload"
[null] 0:0:6,894 - VideoEditingCallbacks -> Called runVideoErrorCallback for inputVideoFile: trim.ACFC6F6D-B574-4898-B2CE-2C1D81BDA6BA.MOV
[null] 0:0:6,894 - VideoEditingCallbacks -> The error callback for inputVideoFile: trim.ACFC6F6D-B574-4898-B2CE-2C1D81BDA6BA.MOV is going to be run
[EDT] 0:0:6,894 - VideoOptimizer native code -> Video export failed with error:
[EDT] 0:0:6,894 - VideoOptimizer native code -> The operation could not be completed
[EDT] 0:0:6,895 - VideoOptimizer native code -> Code of error:
[EDT] 0:0:6,895 - VideoOptimizer native code -> -11800
@shannah
Copy link

shannah commented Mar 30, 2020

Possibliy related (error code -11800):
https://help.netflix.com/en/node/64174

That help doc doesn't say the cause, but alludes to something related to files on the device. In Netflix's case they say to just restart the device or reinstall the app. Worth a try here.

@jsfan3
Copy link
Owner Author

jsfan3 commented Mar 31, 2020

Hi Steve, glad to hear you!
Thank you for the link: yes, it's a problem a legibility of the video files from the Gallery: copying them to the home in the FileSystemStorage solves this issue.

So, my code:

 CN.openGallery(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                if (evt == null || evt.getSource() == null) {
                    if (StartPoint.DEBUG) {
                        Log.p("The user cancelled the capturing of photo or video from camera", Log.DEBUG);
                    }
                    return;
                }
                String source = (String) evt.getSource();
                [etc.]

becomes:

 CN.openGallery(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                if (evt == null || evt.getSource() == null) {
                    if (StartPoint.DEBUG) {
                        Log.p("The user cancelled the capturing of photo or video from camera", Log.DEBUG);
                    }
                    return;
                }
                // we move the temp file to the fileSystemStorage to make iOS working correctly
                String source = FileUtilities.moveTempFileToSafePlace((String) evt.getSource());
                [etc.]

where FileUtilities.moveTempFileToSafePlace copies or moves a temp file to a new random unique path in the FileSystemStorage, using the same extension (this method removes the temp file only if it's in the current app home path).

Copying the temp file to the home resolves another issue with my app.

However, the odd fact is that in the past this copying was not necessary. As I said, this issue happens even on iOS 12 with Xcode 10, so this change of behaviour doesn't seem because of an update of iOS. Maybe is changed something in CodenameOne about the use of the gallery?

What do you think?

I'm going to add a link to this page in the README for people experiencing problems with iOS.

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

No branches or pull requests

2 participants