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

Commit

Permalink
release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Mar 13, 2021
1 parent 528088d commit da1bb4c
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ build/

.settings/
.project
.classpath
.classpath

11 changes: 4 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
## 0.4.0-nullsafety.0
## 0.4.0
- Migrated to nullsafety
- Updated example application, changed example to use full-gpl ffmpeg package (video stabilization not present in full package)
- Fixes issue #266 and possibly #246

### Known issues
- Burn subtitles in example not working properly (stuck at Burning subtitles)

- Fixes issue #246 and #266
- Adds closeFFmpegPipe method to close pipes
- Updated example application

## 0.3.1
- Adds mavenCentral() repository for Android
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# flutter_ffmpeg

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

FFmpeg plugin for Flutter. Supports iOS and Android.
Expand Down Expand Up @@ -35,7 +35,7 @@ FFmpeg plugin for Flutter. Supports iOS and Android.
Add `flutter_ffmpeg` as a dependency in your `pubspec.yaml file`.
```
dependencies:
flutter_ffmpeg: ^0.3.1
flutter_ffmpeg: ^0.4.0
```

#### 2.1 Packages
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ String safeExtGet(String prop, String fallback) {
}

group 'com.arthenica.flutter.ffmpeg'
version '0.3.1'
version '0.4.0'

buildscript {
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;

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

private EventChannel.EventSink eventSink;
private final Registrar registrar;
@SuppressWarnings("deprecation")
private final io.flutter.plugin.common.PluginRegistry.Registrar registrar;
private final FlutterFFmpegResultHandler flutterFFmpegResultHandler;

/**
* Registers plugin to registry.
*
* @param registrar receiver of plugin registration
*/
public static void registerWith(final Registrar registrar) {
@SuppressWarnings("deprecation")
public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
FlutterFFmpegPlugin flutterFFmpegPlugin = new FlutterFFmpegPlugin(registrar);

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

private FlutterFFmpegPlugin(Registrar registrar) {
@SuppressWarnings("deprecation")
private FlutterFFmpegPlugin(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
this.registrar = registrar;

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

} else if (call.method.equals("closeFFmpegPipe")) {
String ffmpegPipePath = call.argument("ffmpegPipePath");

Config.closeFFmpegPipe(ffmpegPipePath);

} else if (call.method.equals("setEnvironmentVariable")) {
String variableName = call.argument("variableName");
String variableValue = call.argument("variableValue");
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
ndkVersion "21.3.6528147"
ndkVersion "21.4.7075529"

lintOptions {
disable 'InvalidPackage'
Expand Down
7 changes: 0 additions & 7 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,3 @@
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }

# Flutter FFmpeg
-keep class com.arthenica.mobileffmpeg.Config {
native <methods>;
void log(int, byte[]);
void statistics(int, float, float, long , int, double, double);
}
3 changes: 1 addition & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
FlutterApplication and put your custom class here. -->
<application
android:label="flutter_ffmpeg_example"
android:icon="@mipmap/ic_launcher"
tools:replace="android:label">
android:icon="@mipmap/ic_launcher">

<activity
android:name=".MainActivity"
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ subprojects {
project.evaluationDependsOn(':app')
}

ext.flutterFFmpegPackage = 'full-gpl'
ext.flutterFFmpegPackage = 'full'

task clean(type: Delete) {
delete rootProject.buildDir
Expand Down
3 changes: 1 addition & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
android.useAndroidX=true
4 changes: 4 additions & 0 deletions example/lib/flutter_ffmpeg_api_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Future<String> registerNewFFmpegPipe() async {
return await _flutterFFmpegConfig.registerNewFFmpegPipe();
}

Future<void> closeFFmpegPipe(String ffmpegPipePath) async {
return await _flutterFFmpegConfig.closeFFmpegPipe(ffmpegPipePath);
}

Future<void> setEnvironmentVariable(
String variableName, String variableValue) async {
return await _flutterFFmpegConfig.setEnvironmentVariable(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pipe_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class PipeTab implements PlayerTab {
}

void asyncAssetWriteToPipe(String assetName, String pipePath) {
VideoUtil.assetToPipe(assetName, pipePath);
VideoUtil.writeAssetToPipeAndClose(assetName, pipePath);
}

void createVideo() {
Expand Down
5 changes: 4 additions & 1 deletion example/lib/video_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class VideoUtil {
return fileFuture;
}

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

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

ffprint('assets/$assetName saved to pipe at $pipePath.');

closeFFmpegPipe(pipePath);
}

static Future<String> assetPath(String assetName) async {
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.4.0-nullsafety.0"
version: "0.4.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -251,7 +251,7 @@ packages:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
video_player_platform_interface:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_ffmpeg_example
description: Demonstrates how to use the flutter_ffmpeg plugin.
version: 0.3.1
version: 0.4.0
publish_to: 'none'

environment:
Expand All @@ -11,9 +11,9 @@ dependencies:
sdk: flutter
cupertino_icons: ^1.0.2
path_provider: ^2.0.1
path: ^1.7.0
path: ^1.8.0
fluttertoast: ^8.0.1-nullsafety.0
video_player: ^2.0.1
video_player: ^2.0.2
flutter_ffmpeg:
path: ../

Expand Down
5 changes: 5 additions & 0 deletions ios/Classes/FlutterFFmpegPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
NSString *pipe = [MobileFFmpegConfig registerNewFFmpegPipe];
result([FlutterFFmpegPlugin toStringDictionary:KEY_PIPE :pipe]);

} else if ([@"closeFFmpegPipe" isEqualToString:call.method]) {

NSString* ffmpegPipePath = call.arguments[@"ffmpegPipePath"];
[MobileFFmpegConfig closeFFmpegPipe:ffmpegPipePath];

} else if ([@"setEnvironmentVariable" isEqualToString:call.method]) {

NSString* variableName = call.arguments[@"variableName"];
Expand Down
2 changes: 1 addition & 1 deletion ios/flutter_ffmpeg.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'flutter_ffmpeg'
s.version = '0.3.1'
s.version = '0.4.0'
s.summary = 'FFmpeg plugin for Flutter.'
s.description = 'FFmpeg plugin based on mobile-ffmpeg for Flutter.'
s.homepage = 'https://github.com/tanersener/flutter-ffmpeg'
Expand Down
11 changes: 11 additions & 0 deletions lib/flutter_ffmpeg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,17 @@ class FlutterFFmpegConfig {
}
}

/// Closes a previously created FFmpeg pipe.
Future<void> closeFFmpegPipe(String ffmpegPipePath) async {
try {
await _methodChannel
.invokeMethod('closeFFmpegPipe', {'ffmpegPipePath': ffmpegPipePath});
} on PlatformException catch (e, stack) {
print("Plugin closeFFmpegPipe error: ${e.message}");
return Future.error("closeFFmpegPipe failed.", stack);
}
}

/// Sets an environment variable.
Future<void> setEnvironmentVariable(
String variableName, String variableValue) async {
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: flutter_ffmpeg
description: Flutter plugin to run FFmpeg on mobile platforms. Supports iOS and Android.
version: 0.4.0-nullsafety.0
version: 0.4.0
homepage: https://github.com/tanersener/flutter-ffmpeg

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.10.0"

dependencies:
flutter:
Expand Down

0 comments on commit da1bb4c

Please sign in to comment.