justsoft / video_thumbnail

This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
MIT License
183 stars 242 forks source link

WITH SOLUTION: MissingPluginException (MissingPluginException(No implementation found for method data on channel video_thumbnail)) #27

Closed egulhan closed 3 years ago

egulhan commented 4 years ago

MissingPluginException (MissingPluginException(No implementation found for method data on channel video_thumbnail))

Same issue here but not resolved: https://github.com/justsoft/video_thumbnail/issues/26

I'm getting same error. I found the bug and how to fix it. If there is space characters in file names, it gives this error. I tested for the same file. One for the file name with space characters and without space characters and I don't get any error about it for the file name without spaces.

Solution: your file names should not have spaces (or maybe other non-ASCII chars) not to get this error.

I handle this situation using following code:

// the file name pattern we want
RegExp regExp = new RegExp(
    r"/^[a-zA-Z0-9_-]+$/",
    caseSensitive: false,
    multiLine: false,
);

if (!regExp.hasMatch(mediaFile.path)) {
    String tempDir = (await getTemporaryDirectory()).path;
    String fileExtension = mediaFile.path.split('.').last;
    String newPath =
        tempDir + '/' + DateTime.now().millisecondsSinceEpoch.toString() + '.' + fileExtension;

    File tempFile =
        await mediaFile.copy(newPath);

    // you can use this new file path for making the thumbnail without error
    mediaPath = tempFile.path;
}
justsoft commented 4 years ago

Thanks for your suggestion. Please take a look my recent updated README regarding the input URL.

To generate the thumbnail from a network resource, the video must be properly URL encoded.

Please try the URL encoded 'video' and leave the output thumbnail path as default to see still an issue.

YazeedAlKhalaf commented 4 years ago

I have the same problem, Is there any solutions?

egulhan commented 4 years ago

Thanks for your suggestion. Please take a look my recent updated README regarding the input URL.

To generate the thumbnail from a network resource, the video must be properly URL encoded.

Please try the URL encoded 'video' and leave the output thumbnail path as default to see still an issue.

It's not about remote resource, about local file.

egulhan commented 4 years ago

I have the same problem, Is there any solutions?

I shared code snippet about handling the error. Please check out it at the bottom of question post.

YazeedAlKhalaf commented 4 years ago

I get but the code does not work, it just keeps the app from crashing, but I get no thumbnails. It says NoSuchMethod....

redvg commented 4 years ago

same here, posted in https://github.com/justsoft/video_thumbnail/issues/8

z234009184 commented 4 years ago

the same

msarkrish commented 4 years ago

It's not working anyone solved this problem. My app depend on local videos. I need to show thumbnails

RuchiMakadia commented 3 years ago

I have same issue want to show thumbnail from local video file but getting same error

justsoft commented 3 years ago

I have same issue want to show thumbnail from local video file but getting same error

Have you tried:

ghost commented 3 years ago

Hi @justsoft I have similer issue, my file path doesn't have any space and non-ASCII chars, also my path file exists and i have permission to write the file but i still take this error, can you tell me what should i do

justsoft commented 3 years ago

Hi @justsoft I have similer issue, my file path doesn't have any space and non-ASCII chars, also my path file exists and i have permission to write the file but i still take this error, can you tell me what should i do

Did you try the my suggestions? Can you play the video by any video play installed on the device?