Skip to content

[Regression] On iOS, wrong app root for videos after app upgrade #3362

@jsfan3

Description

@jsfan3

There is a regression (or I just discovered that the previous fix was incomplete). I refer to this commit:
6cbc741
that solved this issue:
#2551

Currently, after reinstalling an app on iOS, the images are still shown correctly, but videos are not, because the home path is not seamlessly updated. Do you remember that after reinstalling an app on iOS its home path is changed every time?

In the while, I workarounded this issue with this temporary code, that will not more necessary after a proper fix in Codename One:

public static Container getMediaPlayer(String videoFile) throws IOException {
        String videoFilePath;
        String homePath = FileSystemStorage.getInstance().getAppHomePath();
        if (DeviceUtilities.isiOSNative() && !videoFile.startsWith(homePath)) {
            // Small workaround for the change of home path on iOS after upgrading the app
            String myAppDir = "/Documents/app.myapp.client/";
            String relativePath = videoFile.substring(videoFile.lastIndexOf(myAppDir) + myAppDir.length());
            videoFilePath = homePath + relativePath;
        } else {
            videoFilePath = videoFile;
        }
        Log.p("Video file: " + videoFilePath + " lenght (bytes): " + FileSystemStorage.getInstance().getLength(videoFilePath), Log.DEBUG);
       
       [....]
       Media video = MediaManager.createMedia(videoFilePath, true, () -> {
       [....]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions