Skip to content

Commit

Permalink
Ffmpeg native android lib included ABIS for x64 and x86 CPU's -> Flut…
Browse files Browse the repository at this point in the history
…ter recognized x64 ABIS and build the whole project trageting that CPU Architecture. However that caused startup failure on non-x64 CPUS

--> only included the armeabi-v7 instead of all types

- Also APK size shrinked to 50%
See:
flutter/flutter#18494
  • Loading branch information
danielfoehrKn committed Jul 4, 2018
1 parent 14dd7f9 commit 759c83f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion android/app/build.gradle
Expand Up @@ -51,6 +51,9 @@ android {
}
buildTypes {
release {
ndk{
abiFilters 'armeabi-v7a'
}
signingConfig signingConfigs.release
}
}
Expand All @@ -65,7 +68,7 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation(name:'all-fmmr', ext:'aar')
implementation(name:'armv7-fmmr', ext:'aar')
// full exoplayer library
compile 'com.google.android.exoplayer:exoplayer:2.8.1'
}
Expand Up @@ -43,11 +43,10 @@ public void onCancel(Object o) {
public void startPreviewTask(String url, String fileName, String videoId) {

Runnable task = () -> {

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
Bitmap preview;

if (fileName != null){
if (fileName != null) {

File file = new File(Environment.getExternalStorageDirectory() + "/MediathekView", fileName);
Log.i(TAG, "Starting task: preview video with fileName" + fileName + ". File: Can Read: " + file.canRead() + " Lenght: " + file.length());
Expand All @@ -62,8 +61,7 @@ public void startPreviewTask(String url, String fileName, String videoId) {
events.error(TAG, "File to generate preview from - does not exist", null);
return;
}*/
}
else {
} else {
Log.i(TAG, "Starting task: preview video with url : " + url);
mmr.setDataSource(url);

Expand All @@ -75,7 +73,7 @@ public void startPreviewTask(String url, String fileName, String videoId) {
/*preview = mmr.getFrameAtTime(1000000, FFmpegMediaMetadataRetriever.OPTION_NEXT_SYNC); // frame at 2 seconds
mmr.release();
*/
if (preview == null){
if (preview == null) {
Log.e(TAG, "Could not get preview bitmap");
events.error(TAG, "Could not get preview bitmap", null);
return;
Expand All @@ -89,7 +87,7 @@ public void startPreviewTask(String url, String fileName, String videoId) {
byte[] byteArray = stream.toByteArray();
preview.recycle();

Map<String, Object> returnArguments =new HashMap<>();
Map<String, Object> returnArguments = new HashMap<>();
returnArguments.put("image", byteArray);
returnArguments.put("videoId", videoId);

Expand Down
Binary file removed android/app/src/main/libs/all-fmmr.aar
Binary file not shown.
Binary file not shown.

0 comments on commit 759c83f

Please sign in to comment.