Skip to content

Commit f866f01

Browse files
committed
display video resolution at videos
1 parent 259ec1a commit f866f01

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/PropertiesDialog.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class PropertiesDialog : DialogFragment() {
5252
properties_duration_label.visibility = View.VISIBLE
5353
properties_duration.visibility = View.VISIBLE
5454
properties_duration.text = mItem.getDuration(context)
55+
56+
properties_resolution_label.visibility = View.VISIBLE
57+
properties_resolution.visibility = View.VISIBLE
58+
properties_resolution.text = mItem.getVideoResolution(context)
5559
}
5660

5761
val file = File(mItem.path)

library/src/main/kotlin/com/simplemobiletools/filepicker/models/FileDirItem.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ class FileDirItem(val path: String, val name: String, val isDirectory: Boolean,
5959
return getFormattedDuration((timeInMillisec / 1000).toInt())
6060
}
6161

62+
fun getVideoResolution(context: Context): String {
63+
try {
64+
val retriever = MediaMetadataRetriever()
65+
retriever.setDataSource(context, Uri.fromFile(File(path)))
66+
val width = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)
67+
val height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)
68+
return "$width x $height"
69+
} catch (ignored: Exception) {
70+
71+
}
72+
return ""
73+
}
74+
6275
val imageResolution: String
6376
get () {
6477
val bitmap: Bitmap? = BitmapFactory.decodeFile(path)

0 commit comments

Comments
 (0)