Twelve: Split Audio URI and playback URI
Change-Id: Ibe2bab3772f9330265ba4b23f6dbc2598248d56a
diff --git a/app/src/main/java/org/lineageos/twelve/datasources/LocalDataSource.kt b/app/src/main/java/org/lineageos/twelve/datasources/LocalDataSource.kt
index a5c45bd..a9f67ac 100644
--- a/app/src/main/java/org/lineageos/twelve/datasources/LocalDataSource.kt
+++ b/app/src/main/java/org/lineageos/twelve/datasources/LocalDataSource.kt
@@ -155,6 +155,7 @@
Audio(
uri,
+ uri,
mimeType,
title,
audioType,
diff --git a/app/src/main/java/org/lineageos/twelve/models/Audio.kt b/app/src/main/java/org/lineageos/twelve/models/Audio.kt
index 655b7cc..092c129 100644
--- a/app/src/main/java/org/lineageos/twelve/models/Audio.kt
+++ b/app/src/main/java/org/lineageos/twelve/models/Audio.kt
@@ -7,12 +7,15 @@
import android.net.Uri
import androidx.media3.common.MediaMetadata
+import androidx.media3.exoplayer.source.MediaSource
import org.lineageos.twelve.ext.buildMediaItem
/**
* An audio.
*
* @param uri The URI of the audio
+ * @param playbackUri A URI that is understood by Media3 to play the audio. If required, this can be
+ * equal to [uri] and a proper [MediaSource.Factory] can be implemented
* @param mimeType The MIME type of the audio
* @param title The title of the audio
* @param type The type of the audio
@@ -28,6 +31,7 @@
*/
data class Audio(
override val uri: Uri,
+ val playbackUri: Uri,
val mimeType: String,
val title: String,
val type: Type,
@@ -90,7 +94,7 @@
album = albumTitle,
artist = artistName,
genre = genreName,
- sourceUri = uri,
+ sourceUri = playbackUri,
mimeType = mimeType,
)