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 236 forks source link

VideoThumbnailPlugin.java uses or overrides a deprecated API #86

Open faizahmaddae opened 2 years ago

faizahmaddae commented 2 years ago

flutter/.pub-cache/hosted/pub.dartlang.org/video_thumbnail-0.4.3/android/src/main/java/xyz/justsoft/video_thumbnail/VideoThumbnailPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

Sums-shadow commented 2 years ago

Same issue

venomwine commented 2 years ago

Change the minSdkversion from 16 to 21 (In app's build.gradle), this worked in my case.

Tom3652 commented 2 years ago

my minSdkVersion is 24 and i am still having it

ufukhawk commented 2 years ago

any solution ?

justsoft commented 2 years ago

Other users may need a lower version of SDK, so let's keep it as what it is now. Thanks

AlexT84 commented 1 year ago

Does any one has a fix for this? I have same issue.

Paroca72 commented 1 year ago

Same issue here

Usama-Malik123 commented 1 year ago

Note: C:\Users\SCC\AppData\Local\Pub\Cache\git\video_thumbnail-6721fbd48f9c2c15fa4c6c824c648088e6026475\android\src\main\java\xyz\justsoft\video_thumbnail\VideoThumbnailPlugin.java uses or overrides a deprecated API?

PoTheMagicDragon commented 3 months ago

I recompiled with -xlint and got this:

/Users/redacted/.pub-cache/hosted/pub.dev/video_thumbnail-0.5.3/android/src/main/java/xyz/justsoft/video_thumbnail/VideoThumbnailPlugin.java:103: warning: [deprecation] WEBP in CompressFormat has been deprecated
                return Bitmap.CompressFormat.WEBP;

It looks like this is the line with issues: https://github.com/justsoft/video_thumbnail/blob/master/android/src/main/java/xyz/justsoft/video_thumbnail/VideoThumbnailPlugin.java#L103

And a potential solution would be to use Bitmap.CompressFormat.WEBP_LOSSLESS if the API level is 30 or above and use Bitmap.CompressFormat.WEBP if API is less than 30 as referenced here https://stackoverflow.com/questions/59423224/android-bitmap-compressformat-webp-crash

I'm guessing opening a pr with this code would solve the warning:

return Build.VERSION.SDK_INT > 30 ? Bitmap.CompressFormat.WEBP_LOSSLESS : Bitmap.CompressFormat.WEBP;