The origin of problem is UsbFile
from mjdev:libaums and UsbStorageProvider.
I try to extract video frame from uri.getPath() -> /document/usb1002:/GOPR04252.MP4
like
ImageUtils.getVideoThumbnail(documentUri.getPath(), size.x, size.y);
method from ImageUtils
public static Bitmap getVideoThumbnail(String path, int mMaxWidth, int mMaxHeight){
Bitmap.Config mDecodeConfig = Bitmap.Config.RGB_565;
ImageView.ScaleType mScaleType = ImageView.ScaleType.CENTER_CROP;
File bitmapFile = new File(path);
Bitmap bitmap = null;
if (!bitmapFile.exists() || !bitmapFile.isFile()) {
return bitmap;
}
....
}
But it return null. Why and how to fix it?? Is there any other way to solve this problem
OR
Check commented getUsbPath
method call in UsbStorageProvider
//row.add(Document.COLUMN_PATH, getUsbPath(file));
How to implement getUsbPath(UsbFile) method that return path to that file?
Presumption, We can solve situation if we convert UsbFile
to File
or documentUri
to File
In sample words implimenting video thumbnail in AnExplorer for USB OTG