Skip to content
This repository was archived by the owner on Oct 14, 2021. It is now read-only.

Commit da1bb4c

Browse files
committedMar 13, 2021
release v0.4.0
1 parent 528088d commit da1bb4c

19 files changed

+57
-37
lines changed
 

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ build/
99

1010
.settings/
1111
.project
12-
.classpath
12+
.classpath
13+

‎CHANGELOG.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
## 0.4.0-nullsafety.0
1+
## 0.4.0
22
- Migrated to nullsafety
3-
- Updated example application, changed example to use full-gpl ffmpeg package (video stabilization not present in full package)
4-
- Fixes issue #266 and possibly #246
5-
6-
### Known issues
7-
- Burn subtitles in example not working properly (stuck at Burning subtitles)
8-
3+
- Fixes issue #246 and #266
4+
- Adds closeFFmpegPipe method to close pipes
5+
- Updated example application
96

107
## 0.3.1
118
- Adds mavenCentral() repository for Android

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# flutter_ffmpeg
22

3-
![GitHub release](https://img.shields.io/badge/release-v0.3.1-blue.svg)
3+
![GitHub release](https://img.shields.io/badge/release-v0.4.0-blue.svg)
44
![](https://img.shields.io/pub/v/flutter_ffmpeg.svg)
55

66
FFmpeg plugin for Flutter. Supports iOS and Android.
@@ -35,7 +35,7 @@ FFmpeg plugin for Flutter. Supports iOS and Android.
3535
Add `flutter_ffmpeg` as a dependency in your `pubspec.yaml file`.
3636
```
3737
dependencies:
38-
flutter_ffmpeg: ^0.3.1
38+
flutter_ffmpeg: ^0.4.0
3939
```
4040

4141
#### 2.1 Packages

‎android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ String safeExtGet(String prop, String fallback) {
1111
}
1212

1313
group 'com.arthenica.flutter.ffmpeg'
14-
version '0.3.1'
14+
version '0.4.0'
1515

1616
buildscript {
1717
repositories {

‎android/src/main/java/com/arthenica/flutter/ffmpeg/FlutterFFmpegPlugin.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import io.flutter.plugin.common.MethodChannel;
4949
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
5050
import io.flutter.plugin.common.MethodChannel.Result;
51-
import io.flutter.plugin.common.PluginRegistry.Registrar;
5251

5352
/**
5453
* <h3>Flutter FFmpeg Plugin</h3>
@@ -90,15 +89,17 @@ public class FlutterFFmpegPlugin implements MethodCallHandler, EventChannel.Stre
9089
public static final String EVENT_EXECUTE = "FlutterFFmpegExecuteCallback";
9190

9291
private EventChannel.EventSink eventSink;
93-
private final Registrar registrar;
92+
@SuppressWarnings("deprecation")
93+
private final io.flutter.plugin.common.PluginRegistry.Registrar registrar;
9494
private final FlutterFFmpegResultHandler flutterFFmpegResultHandler;
9595

9696
/**
9797
* Registers plugin to registry.
9898
*
9999
* @param registrar receiver of plugin registration
100100
*/
101-
public static void registerWith(final Registrar registrar) {
101+
@SuppressWarnings("deprecation")
102+
public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
102103
FlutterFFmpegPlugin flutterFFmpegPlugin = new FlutterFFmpegPlugin(registrar);
103104

104105
final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_ffmpeg");
@@ -108,7 +109,8 @@ public static void registerWith(final Registrar registrar) {
108109
eventChannel.setStreamHandler(flutterFFmpegPlugin);
109110
}
110111

111-
private FlutterFFmpegPlugin(Registrar registrar) {
112+
@SuppressWarnings("deprecation")
113+
private FlutterFFmpegPlugin(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
112114
this.registrar = registrar;
113115

114116
this.flutterFFmpegResultHandler = new FlutterFFmpegResultHandler();
@@ -286,6 +288,11 @@ public void apply(final Statistics statistics) {
286288
final String pipe = Config.registerNewFFmpegPipe(getActiveContext());
287289
flutterFFmpegResultHandler.success(result, toStringMap(KEY_PIPE, pipe));
288290

291+
} else if (call.method.equals("closeFFmpegPipe")) {
292+
String ffmpegPipePath = call.argument("ffmpegPipePath");
293+
294+
Config.closeFFmpegPipe(ffmpegPipePath);
295+
289296
} else if (call.method.equals("setEnvironmentVariable")) {
290297
String variableName = call.argument("variableName");
291298
String variableValue = call.argument("variableValue");

‎example/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2626

2727
android {
2828
compileSdkVersion 29
29-
ndkVersion "21.3.6528147"
29+
ndkVersion "21.4.7075529"
3030

3131
lintOptions {
3232
disable 'InvalidPackage'

‎example/android/app/proguard-rules.pro

-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,3 @@
1616
-keep class io.flutter.view.** { *; }
1717
-keep class io.flutter.** { *; }
1818
-keep class io.flutter.plugins.** { *; }
19-
20-
# Flutter FFmpeg
21-
-keep class com.arthenica.mobileffmpeg.Config {
22-
native <methods>;
23-
void log(int, byte[]);
24-
void statistics(int, float, float, long , int, double, double);
25-
}

‎example/android/app/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
FlutterApplication and put your custom class here. -->
1616
<application
1717
android:label="flutter_ffmpeg_example"
18-
android:icon="@mipmap/ic_launcher"
19-
tools:replace="android:label">
18+
android:icon="@mipmap/ic_launcher">
2019

2120
<activity
2221
android:name=".MainActivity"

‎example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ subprojects {
2525
project.evaluationDependsOn(':app')
2626
}
2727

28-
ext.flutterFFmpegPackage = 'full-gpl'
28+
ext.flutterFFmpegPackage = 'full'
2929

3030
task clean(type: Delete) {
3131
delete rootProject.buildDir

‎example/android/gradle.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.enableJetifier=true
3-
android.useAndroidX=true
4-
android.enableR8=true
3+
android.useAndroidX=true

‎example/lib/flutter_ffmpeg_api_wrapper.dart

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ Future<String> registerNewFFmpegPipe() async {
143143
return await _flutterFFmpegConfig.registerNewFFmpegPipe();
144144
}
145145

146+
Future<void> closeFFmpegPipe(String ffmpegPipePath) async {
147+
return await _flutterFFmpegConfig.closeFFmpegPipe(ffmpegPipePath);
148+
}
149+
146150
Future<void> setEnvironmentVariable(
147151
String variableName, String variableValue) async {
148152
return await _flutterFFmpegConfig.setEnvironmentVariable(

‎example/lib/pipe_tab.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class PipeTab implements PlayerTab {
6060
}
6161

6262
void asyncAssetWriteToPipe(String assetName, String pipePath) {
63-
VideoUtil.assetToPipe(assetName, pipePath);
63+
VideoUtil.writeAssetToPipeAndClose(assetName, pipePath);
6464
}
6565

6666
void createVideo() {

‎example/lib/video_util.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class VideoUtil {
7474
return fileFuture;
7575
}
7676

77-
static void assetToPipe(String assetName, String pipePath) async {
77+
static void writeAssetToPipeAndClose(
78+
String assetName, String pipePath) async {
7879
final ByteData byteData = await rootBundle.load('assets/$assetName');
7980

8081
var pipeFile = new File(pipePath);
@@ -85,6 +86,8 @@ class VideoUtil {
8586
flush: false);
8687

8788
ffprint('assets/$assetName saved to pipe at $pipePath.');
89+
90+
closeFFmpegPipe(pipePath);
8891
}
8992

9093
static Future<String> assetPath(String assetName) async {

‎example/pubspec.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ packages:
8282
path: ".."
8383
relative: true
8484
source: path
85-
version: "0.4.0-nullsafety.0"
85+
version: "0.4.0"
8686
flutter_test:
8787
dependency: "direct dev"
8888
description: flutter
@@ -251,7 +251,7 @@ packages:
251251
name: video_player
252252
url: "https://pub.dartlang.org"
253253
source: hosted
254-
version: "2.0.1"
254+
version: "2.0.2"
255255
video_player_platform_interface:
256256
dependency: transitive
257257
description:

‎example/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_ffmpeg_example
22
description: Demonstrates how to use the flutter_ffmpeg plugin.
3-
version: 0.3.1
3+
version: 0.4.0
44
publish_to: 'none'
55

66
environment:
@@ -11,9 +11,9 @@ dependencies:
1111
sdk: flutter
1212
cupertino_icons: ^1.0.2
1313
path_provider: ^2.0.1
14-
path: ^1.7.0
14+
path: ^1.8.0
1515
fluttertoast: ^8.0.1-nullsafety.0
16-
video_player: ^2.0.1
16+
video_player: ^2.0.2
1717
flutter_ffmpeg:
1818
path: ../
1919

‎ios/Classes/FlutterFFmpegPlugin.m

+5
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
226226
NSString *pipe = [MobileFFmpegConfig registerNewFFmpegPipe];
227227
result([FlutterFFmpegPlugin toStringDictionary:KEY_PIPE :pipe]);
228228

229+
} else if ([@"closeFFmpegPipe" isEqualToString:call.method]) {
230+
231+
NSString* ffmpegPipePath = call.arguments[@"ffmpegPipePath"];
232+
[MobileFFmpegConfig closeFFmpegPipe:ffmpegPipePath];
233+
229234
} else if ([@"setEnvironmentVariable" isEqualToString:call.method]) {
230235

231236
NSString* variableName = call.arguments[@"variableName"];

‎ios/flutter_ffmpeg.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'flutter_ffmpeg'
3-
s.version = '0.3.1'
3+
s.version = '0.4.0'
44
s.summary = 'FFmpeg plugin for Flutter.'
55
s.description = 'FFmpeg plugin based on mobile-ffmpeg for Flutter.'
66
s.homepage = 'https://github.com/tanersener/flutter-ffmpeg'

‎lib/flutter_ffmpeg.dart

+11
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,17 @@ class FlutterFFmpegConfig {
401401
}
402402
}
403403

404+
/// Closes a previously created FFmpeg pipe.
405+
Future<void> closeFFmpegPipe(String ffmpegPipePath) async {
406+
try {
407+
await _methodChannel
408+
.invokeMethod('closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath});
409+
} on PlatformException catch (e, stack) {
410+
print("Plugin closeFFmpegPipe error: ${e.message}");
411+
return Future.error("closeFFmpegPipe failed.", stack);
412+
}
413+
}
414+
404415
/// Sets an environment variable.
405416
Future<void> setEnvironmentVariable(
406417
String variableName, String variableValue) async {

‎pubspec.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: flutter_ffmpeg
22
description: Flutter plugin to run FFmpeg on mobile platforms. Supports iOS and Android.
3-
version: 0.4.0-nullsafety.0
3+
version: 0.4.0
44
homepage: https://github.com/tanersener/flutter-ffmpeg
55

66
environment:
77
sdk: '>=2.12.0 <3.0.0'
8+
flutter: ">=1.10.0"
89

910
dependencies:
1011
flutter:

0 commit comments

Comments
 (0)
This repository has been archived.