souvik-ghosh / react-native-create-thumbnail

iOS/Android thumbnail generator with support for both local and remote videos
MIT License
246 stars 105 forks source link

Unreported exception error IOException; it must be caught or declared to be thrown. "retriever.release()" #96

Closed DiaoMIngHero closed 8 months ago

DiaoMIngHero commented 1 year ago

Describe the bug image

To Reproduce 1.add dependency 2.run

Version react-native-create-thumbnail 1.6.4

Expected Results no exception

Snack, code example, screenshot, or link to a repository

yoon123456 commented 1 year ago

I have the same problem. please solve

MichaelDanielTom commented 1 year ago

The easiest way to fix until prs are approved is to use patch-package to add those two errors in java like:

diff --git a/node_modules/react-native-create-thumbnail/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java b/node_modules/react-native-create-thumbnail/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java
index 9bd67d8..6188e43 100644
--- a/node_modules/react-native-create-thumbnail/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java
+++ b/node_modules/react-native-create-thumbnail/android/src/main/java/com/createthumbnail/CreateThumbnailModule.java
@@ -168,7 +168,7 @@ public class CreateThumbnailModule extends ReactContextBaseJavaModule {
         return dir;
     }

-    private static Bitmap getBitmapAtTime(Context context, String filePath, int time, Map headers) {
+    private static Bitmap getBitmapAtTime(Context context, String filePath, int time, Map headers) throws IOException, IllegalStateException {
         MediaMetadataRetriever retriever = new MediaMetadataRetriever();
         if (URLUtil.isFileUrl(filePath)) {
             String decodedPath;
Shiva207892 commented 1 year ago

try { // Code that may throw an IOException retriever.release(); } catch (IOException e) { // Handle the IOException, you can log it or take appropriate actions. e.printStackTrace(); }

mattlewer commented 1 year ago

@souvik-ghosh Same problem here, preventing us running a new build.

"react-native": "0.72.1" "react-native-create-thumbnail": "1.6.4"

Tried '2.0.0-rc.2' but no luck there either.

saif-o99 commented 1 year ago

@souvik-ghosh Same here with:

"react-native": "0.71.7" "react-native-create-thumbnail": "1.6.4"

MarcoBallotti commented 1 year ago

try { // Code that may throw an IOException retriever.release(); } catch (IOException e) { // Handle the IOException, you can log it or take appropriate actions. e.printStackTrace(); }

this solved for me

souvik-ghosh commented 8 months ago

Duplicate of https://github.com/souvik-ghosh/react-native-create-thumbnail/issues/76