Skip to content
Snippets Groups Projects
Commit 0520ca6b authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Mitigate black video thumbnails provided by Android

parent a5375530
No related branches found
No related tags found
1 merge request!528Mitigate black video thumbnails provided by Android
Pipeline #15964 passed with stage
in 3 minutes and 11 seconds
......@@ -84,9 +84,15 @@ object ThumbnailsProvider {
if (cacheBM != null) return cacheBM
if (hasCache && File(thumbPath).exists()) return readCoverBitmap(thumbPath, width)
if (media.isThumbnailGenerated) return null
val bitmap = synchronized(lock) {
var bitmap = synchronized(lock) {
ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MINI_KIND)
}
if (bitmap != null) {
val emptyBitmap = Bitmap.createBitmap(bitmap.width, bitmap.height, bitmap.config)
if (bitmap.sameAs(emptyBitmap)) { // myBitmap is empty/blank3
bitmap = null
}
}
if (bitmap != null) {
BitmapCache.addBitmapToMemCache(thumbPath, bitmap)
if (hasCache) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment