play

fun play(rawResourceId: Int)

Android-specific implementation of the play method which uses a ContentResolver to calculate the Uri of a raw file resource bundled with the app.


actual fun play(url: String)
actual fun play()
expect fun play(url: String)

Start playback of the audio resource at the provided url.

Resource URI

Can be a remote HTTP(s) url, or a files URI obtained via Res.getUri("files/sample.mp3").

Check the JetBrains docs on how to store raw files as part of multiplatform project resources.

On Android, you can resolve the resource URI using something like:

  val uri = Uri.Builder()
.scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
.appendPath("${R.raw.name_of_your_resource}")
.build().toString()

expect fun play()

Resumes audio playback from the current position if it was previously paused.

This function has no effect if the player is already in a playing state.

actual fun play(url: String)
actual fun play()
actual fun play(url: String)
actual fun play()
actual fun play(url: String)
actual fun play()