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

🚨 ffmpeg_kit_flutter fails to build due to old v1 embedding (PluginRegistry.Registrar) #1113

Open
AtharvShinde2004 opened this issue Feb 20, 2025 · 7 comments

Comments

@AtharvShinde2004
Copy link

Description:
I am using the latest Flutter SDK, but ffmpeg_kit_flutter fails to compile due to the use of deprecated v1 embedding (PluginRegistry.Registrar) in FFmpegKitFlutterPlugin.java.

Error Message:

error: cannot find symbol
    public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
                                                                                 ^
  symbol:   class Registrar
  location: interface PluginRegistry

This issue occurs because Flutter v1 embedding has been removed, and Registrar is no longer available in Flutter 3.x. The plugin must be updated to use Flutter v2 embedding.


Steps to Reproduce:

  1. Use Flutter 3.x (latest stable release).
  2. Add ffmpeg_kit_flutter to pubspec.yaml:
    dependencies:
      ffmpeg_kit_flutter: ^6.0.3
  3. Run:
    flutter pub get
    flutter run
  4. The build fails with the PluginRegistry.Registrar error.

Suggested Fix (Solution)

To fix this, update FFmpegKitFlutterPlugin.java to remove deprecated v1 embedding references.

🔹 1. Remove registerWith() (Deprecated)

In FFmpegKitFlutterPlugin.java, remove this method:

@SuppressWarnings("deprecation")
public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
    final Context context = (registrar.activity() != null) ? registrar.activity() : registrar.context();
    if (context == null) {
        Log.w(LIBRARY_NAME, "FFmpegKitFlutterPlugin can not be registered without a context.");
        return;
    }
    FFmpegKitFlutterPlugin plugin = new FFmpegKitFlutterPlugin();
    plugin.init(registrar.messenger(), context, registrar.activity(), registrar, null);
}

🔹 2. Fix init() Method (Remove Registrar)

Find:

protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final io.flutter.plugin.common.PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) {

Replace with:

protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final ActivityPluginBinding activityBinding) {

🔹 3. Remove registrar Usage

Find:

if (registrar != null) {
    // V1 embedding setup for activity listeners.
    registrar.addActivityResultListener(this);
} else {
    // V2 embedding setup for activity listeners.
    activityBinding.addActivityResultListener(this);
}

Replace with:

activityBinding.addActivityResultListener(this);

Environment:

  • Flutter Version: (Run flutter --version)
  • Dart Version: (Run dart --version)
  • ffmpeg_kit_flutter Version: 6.0.3
  • Platform: Android

Expected Behavior:

The plugin should use Flutter v2 embedding and not reference PluginRegistry.Registrar.

Actual Behavior:

Build fails due to outdated v1 embedding (Registrar), preventing the project from compiling.


Additional Notes

  • Flutter has fully removed v1 embedding, and all plugins must migrate to v2.
  • This issue is blocking many users from using ffmpeg_kit_flutter in Flutter 3.x.

Request:

🔹 Please update FFmpegKitFlutterPlugin.java to fully support Flutter v2 embedding.
🔹 Consider releasing a patched version (6.0.4) with this fix.

@AtharvShinde2004
Copy link
Author

is there any use of creating issue as this project is no more maintend, as i request the developers or maintainers to accept all the fixes and PRs before removing the files from everywhere, or find someone who can fix the errors or maintain this package further, i can also maintain this package fully. for more details you can contact on [email protected]

@tanersener
Copy link
Collaborator

We don’t have the capacity to review pull requests, so they will be ignored.

i can also maintain this package fully

I’m not sure which package you’re referring to. But just as a reminder; the native libraries (Android, iOS, macOS) will be removed on April 1st. After that, the Flutter and React Native plugins will also stop working.

We’d be happy if someone continues maintaining the project, but no approval from us is needed. Developers are free to fork the project and maintain it independently. If we come across a fork that picks up where we left off, we’ll add its link to our README to help users find it. However, we haven’t seen any such forks yet.

@AtharvShinde2004
Copy link
Author

I have already uploaded a fixed version of this package in my repo, need some time to fix more bugs and I will push the main fixed package

@mdsomad
Copy link

mdsomad commented Feb 20, 2025

If these people do not maintain the library then you should fork it and add a new library, this is a very useful library.

@AtharvShinde2004
Copy link
Author

I am trying to fix it but I only want to focus on Android Related Flutter Package of this ffmpeg Kit Package. Because I don't want the headache of other react native, ios bugs fixing

@mdsomad
Copy link

mdsomad commented Feb 20, 2025

That's right, don't worry about React Native and other frameworks, just fix Flutter's library, nothing else is needed.

@i-jared
Copy link

i-jared commented Feb 24, 2025

fixed this in my repo. flutter only:
https://github.com/i-jared/ffmpeg_kit_flutter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants