I'm getting this error when using exoplayer even though i'm specifying the mimo type so don't understand why this crash is happening. The version i'm using is 2.18.7:
videoUrl?.let {
if (it.endsWith(".m3u8")) {
val mediaItem = MediaItem.Builder()
.setUri(it)
.setMimeType(MimeTypes.APPLICATION_M3U8)
.build()
exoPlayer?.setMediaItem(mediaItem)
} else {
exoPlayer?.setMediaItem(MediaItem.fromUri(it))
}
}
I was expecting for the video to play normally
To play HLS streams (or DASH, Smooth Streaming), you need to add the HLS dependency to your
build.gradlefile.For Media3 ExoPlayer, that is:
So, add:
(Replace the version number with the most recent one.)
And for ExoPlayer 2.x, it is: