I'm using Android new Media3 Exoplayer
library following this code-lab, but there is no workaround to play video from the res/raw directory. My code for playing from the res/raw directory is
val uri = RawResourceDataSource.buildRawResourceUri(R.raw.my_video)
val mediaItem = MediaItem.fromUri(uri)
exoPlayer.setMediaItem(mediaItem)
The above code is not working and if I create MediaItem with an mp4
URL then it is working. Code for mp4
URL is
val mediaItem = MediaItem.fromUri(getString(R.string.media_url_mp4))
exoPlayer.setMediaItem(mediaItem)
Can anyone please help me how to resolve this issue?
Thanks in advance!