📜  如何从文件 kotlin 代码示例中获取持续时间

📅  最后修改于: 2022-03-11 14:53:32.035000             🧑  作者: Mango

代码示例1
// for android 10+
val uri = Uri.parse("full/path/to/file\ or /link/to/internet/resource")
var durationTime: Long
MediaPlayer.create(this, uri).also {
  durationTime = (it.duration / 1000).toLong()
  it.reset()
  it.release()
}