I tried to use MediaMetadataRetriever
with Kotlin use
:
MediaMetadataRetriever().apply {
setDataSource(context, uri)
}.use {
...
}
But it gives me an error on Android 6 Marshmallow (23 API):
java.lang.ClassCastException: android.media.MediaMetadataRetriever cannot be cast to java.lang.AutoCloseable
Why so?
MediaMetadataRetriever
implements AutoCloseable
since API level 29.