diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt index 72a936d47..b64048b88 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/File.kt @@ -13,7 +13,7 @@ fun File.isImageSlow() = absolutePath.isImageFast() || getMimeType().startsWith( fun File.isVideoSlow() = absolutePath.isVideoFast() || getMimeType().startsWith("video") fun File.isAudioSlow() = getMimeType().startsWith("audio") -fun File.getMimeType(default: String = ""): String { +fun File.getMimeType(default: String = getDefaultMimeType()): String { return try { val retriever = MediaMetadataRetriever() retriever.setDataSource(path) @@ -23,6 +23,8 @@ fun File.getMimeType(default: String = ""): String { } } +fun File.getDefaultMimeType() = if (isVideoFast()) "video/*" else "image/*" + fun File.getDuration(): String { val retriever = MediaMetadataRetriever() retriever.setDataSource(path)