-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Describe the bug
I was developing multiplatform audio player using MediaPlayer for Android, AVAudioPlayer for iOS. I used new resource api Res.getUri()
to get URI of the mp3 file.
actual class AudioPlayer actual constructor(uri: String) {
private val mediaPlayer = MediaPlayer().apply {
setDataSource(MainActivity.appContext, uri.toUri())
prepare()
}
actual fun play() = mediaPlayer.start()
}
val audioPlayer = AudioPlayer(Res.getUri("files/Sample.mp3"))
iOS works fine. By the way, there is an issue with Android:
Failed to open file 'jar:file:/data/app/~~iN2KoRgBjEr0KuRV7TmyrT==/com.example.audioplayer-1F2AEdsqRz5PTffEv0pF3t==/base.apk!/files/Sample.mp3'. (No such file or directory)
Affected platforms
- Android(Compose multiplatform resource issue)
Versions
- Libraries:
- Compose Multiplatform version: 1.6.10
- Kotlin version: 1.9.23
Woren and maxfie1d