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

MissingPluginException(No implementation found for method file on channel video_thumbnail) #23

Closed
atheist1 opened this issue Apr 20, 2020 · 11 comments

Comments

@atheist1
Copy link

I changed the plugin photo which i pick video before to the plugin file_picker and then i get this error.
The difference between this two plugin may be is the path to the file.First plugin copy the file to application temp storage then give a new path and the second one give an absolute path(/storage/emulated/0/DCIM/Camera/VID_20200420_171228.mp4).
what should i do if i dont wont to copy the original file?
The plugins version is 0.2.0. and the code is

static getVideoThumbNail(String filePath) async {
    String tempPath = (await getLocalOrTempDir()).path;
    try {
      var imageData = await VideoThumbnail.thumbnailFile(
        video: filePath,
        imageFormat: ImageFormat.PNG,
        maxWidth: 256,
        maxHeight: 256,
        thumbnailPath: tempPath,
        quality: 50,
      );
      return imageData;
    } catch (e) {
      print(e);
      eventBus.fire(showToast(CommonUtils.getLocale(null).noThumbnail));
      return null;
    }
  }
@justsoft
Copy link
Owner

You need to make sure your App has permission to read the absolute path.
You might use File class to check the App can read from the video first.
Take a look my example or my comments for other users, or just google it.
Basically it needs read permissions for the photo gallery.

@atheist1
Copy link
Author

I have give the permission to my app.
I write those on my AndroidManifest.xml

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

and the video is record by my phone. I am sure that the video can play on my phone.
I rewrite the code to this.

  static getVideoThumbNail(String filePath) async {
    String tempPath = (await getLocalOrTempDir()).path;
    try {
      File file = new File(filePath);
      print('exists ${file.existsSync()}');

      print('tempPath ${tempPath}');
//      var imageData = await VideoThumbnail.thumbnailFile(
//        video: filePath,
//        imageFormat: ImageFormat.PNG,
//        maxWidth: 256,
//        maxHeight: 256,
//        thumbnailPath: tempPath,
//        quality: 50,
//      );
//      return imageData;
    } catch (e) {
      print(e);
      eventBus.fire(showToast(CommonUtils.getLocale(null).noThumbnail));
      return null;
    }
  }

The log is

2020-04-20 18:14:36.340 26771-26924/com.mooncell.shangxian I/flutter: tempPath /storage/emulated/0
2020-04-20 18:14:36.341 26771-26924/com.mooncell.shangxian I/flutter: exists true

@justsoft
Copy link
Owner

Try the thumbnailData first.

@atheist1
Copy link
Author

Apologize for my careless and waste of you time.I write it on my xml but forget to request permission dynamic cause i changed my device.Thanks for u reply.

@devanshkaria88
Copy link

devanshkaria88 commented Sep 10, 2020

I have a similar issue. I am trying to get a thumbnail from a video picked using the flutter_file_picker plugin and I am getting this issue.

`

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.CAMERA" />

<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-permission android:name="android.permission.FLASHLIGHT" />`

This is my AndroidManifest.xml permission part. and I am using this plugin in a similar way that @atheist1 used.

Looking for your response as quickly as possible as this is for production purposes.

Edit : This issue is only found in devices with Andoird 9 or below. and the flutter version that I am using is 1.20.0

@rgb1380
Copy link

rgb1380 commented Dec 28, 2020

I was constructing an invalid thumbnail path and was getting this error. Spend quite a bit of time as the impression from the error is a compile-time/binding issue. Will be good to throw a specific error when the thumbnail path is invalid or one does not have permission to the specified path.

@Stitch-Taotao
Copy link

I definitely certain the problem is that ,you through a wrong path ,you should pass a exit dir-Path to de thumbnailPath parameter

@kevin4dhd
Copy link

same error

@justsoft
Copy link
Owner

Please check out the new 0.5.0 version. Thanks.

@dawarepramod4
Copy link

flutter clean and then try running again ... i got it solved like this only..

@Mashi-91
Copy link

its platform error, i am facing this error on windows

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

8 participants