display video resolution at videos
This commit is contained in:
parent
259ec1a0e7
commit
f866f01ddf
|
@ -52,6 +52,10 @@ class PropertiesDialog : DialogFragment() {
|
||||||
properties_duration_label.visibility = View.VISIBLE
|
properties_duration_label.visibility = View.VISIBLE
|
||||||
properties_duration.visibility = View.VISIBLE
|
properties_duration.visibility = View.VISIBLE
|
||||||
properties_duration.text = mItem.getDuration(context)
|
properties_duration.text = mItem.getDuration(context)
|
||||||
|
|
||||||
|
properties_resolution_label.visibility = View.VISIBLE
|
||||||
|
properties_resolution.visibility = View.VISIBLE
|
||||||
|
properties_resolution.text = mItem.getVideoResolution(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
val file = File(mItem.path)
|
val file = File(mItem.path)
|
||||||
|
|
|
@ -59,6 +59,19 @@ class FileDirItem(val path: String, val name: String, val isDirectory: Boolean,
|
||||||
return getFormattedDuration((timeInMillisec / 1000).toInt())
|
return getFormattedDuration((timeInMillisec / 1000).toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getVideoResolution(context: Context): String {
|
||||||
|
try {
|
||||||
|
val retriever = MediaMetadataRetriever()
|
||||||
|
retriever.setDataSource(context, Uri.fromFile(File(path)))
|
||||||
|
val width = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)
|
||||||
|
val height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)
|
||||||
|
return "$width x $height"
|
||||||
|
} catch (ignored: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
val imageResolution: String
|
val imageResolution: String
|
||||||
get () {
|
get () {
|
||||||
val bitmap: Bitmap? = BitmapFactory.decodeFile(path)
|
val bitmap: Bitmap? = BitmapFactory.decodeFile(path)
|
||||||
|
|
Loading…
Reference in New Issue