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

Python & FFmpeg as downloadable plugins #248

Open
JunkFood02 opened this issue Aug 22, 2023 · 12 comments · May be fixed by #256
Open

Python & FFmpeg as downloadable plugins #248

JunkFood02 opened this issue Aug 22, 2023 · 12 comments · May be fixed by #256
Assignees
Labels
enhancement New feature or request

Comments

@JunkFood02
Copy link
Collaborator

Currently, the python interpreter executable and the FFmpeg libraries are pre-compiled zip files which get bundled in every apk built with this library. However, the binaries rarely get updates like the app or the library. Users would have to download the apk with the same binaries included when the app gets an update, again and again. This will waste a lot of bandwidth and hurt users' enthusiasm to update to the latest version.

@JunkFood02 JunkFood02 added the enhancement New feature or request label Aug 22, 2023
@BobbyESP
Copy link

BobbyESP commented Aug 22, 2023

Agree with that; probably this would mean a library rewrite, right?

@JunkFood02
Copy link
Collaborator Author

a library rewrite

Not really, if you take a look at the initialize part of the library, you'll notice that we'll only need a valid zip file to be unzip to the hardcoded destination, despite of where the zip file comes: downloaded from somewhere or extracted from apk (appContext.applicationInfo.nativeLibraryDir)

@BobbyESP
Copy link

Yess. Well seen

1 similar comment
@BobbyESP
Copy link

Yess. Well seen

@BobbyESP
Copy link

Where this zips would be hosted?

@JunkFood02
Copy link
Collaborator Author

Where this zips would be hosted?

Similarly, we can host these binaries in the release section of a separate GitHub repository

@BobbyESP
Copy link

Where this zips would be hosted?

Similarly, we can host these binaries in the release section of a separate GitHub repository

It's a good idea.

@JunkFood02
Copy link
Collaborator Author

JunkFood02 commented Nov 11, 2023

Here is some additional input if anyone is interested in this: the executable files themselves (libpython.so, and libffmpeg.so), need to be packaged and shipped along with apks. And the files which can be downloaded, unzipped and loaded are the dependencies of the executables (libpython.zip.so, and libffmpeg.zip.so)

This change is introduced in Android 10: https://developer.android.com/about/versions/10/behavior-changes-10#execute-permission

@JunkFood02
Copy link
Collaborator Author

To ensure that dependencies are downloaded and loaded after the first cold start, we need to design a reliable process that includes exception handling, downloading progress tracking, and the ability to detect and apply updates online. We should also consider which parts of this process should be implemented in the library itself and which parts should be left to the library's users (app developers).

Additionally, we should maintain the original method of loading dependencies from the APK or external files, since network connections are not always reliable or simply for compatibility.

@BobbyESP
Copy link

Here is some additional input if anyone is interested in this: the executable files themselves (libpython.so, and libffmpeg.so), need to be packaged and shipped along with apks. And the files which can be downloaded, unzipped and loaded are the dependencies of the executables (libpython.zip.so, and libffmpeg.zip.so)

This change is introduced in Android 10: developer.android.com/about/versions/10/behavior-changes-10#execute-permission

Exactly what I thought. We can leave packaged in the library those two first and the ones left, downloaded from a hosting service or even GitHub Releases.

@BobbyESP
Copy link

BobbyESP commented Nov 11, 2023

To ensure that dependencies are downloaded and loaded after the first cold start, we need to design a reliable process that includes exception handling, downloading progress tracking, and the ability to detect and apply updates online. We should also consider which parts of this process should be implemented in the library itself and which parts should be left to the library's users (app developers).

Additionally, we should maintain the original method of loading dependencies from the APK or external files, since network connections are not always reliable or simply for compatibility.

We could use Ktor Client or maybe OkHttp for the downloading process, downloading the files in the tmp folder of the app data directory, and after that, unzip it and move the dir to the executable's directory

@BobbyESP
Copy link

Hi, I'm back with some news. I've made a branch where I will try to achieve this; the ability to download the packages in-app and not to make them be present at the build time increasing the app size. By the moment I have just created the files downloader with Ktor Client. Any other progress will be told here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants