Description
When adding an image with a supported mimeType (.heic) as a mediaItem, and generating a video using the transformer, it will return an error with the message "Image format not supported by given bitmapLoader", although it should be supported.
The issue seems to be that in function isImage() from the DefaultAssetLoaderFactory, the mimeType is coming from the contentResolver directly as heic, and then checked with the function isBitmapFactorySupportedMimeType() that only checks for heif instead of heic and heif.
[...]
if (mimeType == null) {
if (Objects.equals(localConfiguration.uri.getScheme(), ContentResolver.SCHEME_CONTENT)) {
ContentResolver cr = context.getContentResolver();
mimeType = cr.getType(localConfiguration.uri);
} else {
mimeType = getCommonImageMimeTypeFromExtension(localConfiguration.uri);
}
}
[...]
checkState(
bitmapLoader.supportsMimeType(mimeType),
"Image format not supported by given bitmapLoader");
[...]
If the mimetype does not come from the content resolver, it will be extracted from the file extension and "commonized" using getCommonImageMimeTypeFromExtension()
In this case, if the image is heic, it will return a heif mimetype, and will pass the isBitmapFactorySupportedMimeType() check.
Of course this should happen with many other image types.
My question is, is there any way of skipping this check? I have tried setting the mimetype directly to the mediaItem, but it seems to be ignored for this case. Maybe this is a bug and supportsMimeType() should "commonize" all mimetypes.
Thanks!