ExoPlayer reading mp3 file from raw folder
问题 Is there any possibility to set an mp3 file that's located in the app's raw folder to ExoPlayer? I tried to achieve it with the following code snippet without success unfortunately: mMediaPath = "android.resource://" + getPackageName() + File.separator + R.raw.ringtone; Any help is greatly appreciated! 回答1: It's possible to load files from the raw folder, the key is to use RawSourceDataSource . Here's an example(in Kotlin) to create a LoopingMediaSource for an mp3file in the raw directory: