mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Fix supported audio types (#1173)
## Description Fixes the list of supported audio types when playing music. This fixes allows for playback of audio formats like ALAC, PCM/WAV, Vorbis, etc. ### Related issues Fixes #1168 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
7ccef6f802
commit
46beee00bb
1 changed files with 5 additions and 8 deletions
|
|
@ -30,7 +30,7 @@ import com.github.damontecres.wholphin.util.BlockingList
|
||||||
import com.github.damontecres.wholphin.util.LoadingState
|
import com.github.damontecres.wholphin.util.LoadingState
|
||||||
import com.github.damontecres.wholphin.util.PlaybackItemState
|
import com.github.damontecres.wholphin.util.PlaybackItemState
|
||||||
import com.github.damontecres.wholphin.util.TrackActivityPlaybackListener
|
import com.github.damontecres.wholphin.util.TrackActivityPlaybackListener
|
||||||
import com.github.damontecres.wholphin.util.profile.Codec
|
import com.github.damontecres.wholphin.util.profile.supportedAudioCodecs
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
@ -83,6 +83,8 @@ class MusicService
|
||||||
private val _state = MutableStateFlow(MusicServiceState.EMPTY)
|
private val _state = MutableStateFlow(MusicServiceState.EMPTY)
|
||||||
val state: StateFlow<MusicServiceState> = _state
|
val state: StateFlow<MusicServiceState> = _state
|
||||||
|
|
||||||
|
private val audioFormats by lazy { listOf(*supportedAudioCodecs) }
|
||||||
|
|
||||||
val player: Player by lazy {
|
val player: Player by lazy {
|
||||||
ExoPlayer
|
ExoPlayer
|
||||||
.Builder(context)
|
.Builder(context)
|
||||||
|
|
@ -286,14 +288,9 @@ class MusicService
|
||||||
val url =
|
val url =
|
||||||
api.universalAudioApi.getUniversalAudioStreamUrl(
|
api.universalAudioApi.getUniversalAudioStreamUrl(
|
||||||
itemId = audio.id,
|
itemId = audio.id,
|
||||||
container =
|
container = audioFormats,
|
||||||
listOf(
|
|
||||||
Codec.Audio.OPUS,
|
|
||||||
Codec.Audio.MP3,
|
|
||||||
Codec.Audio.AAC,
|
|
||||||
Codec.Audio.FLAC,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
Timber.i("url=%s", url)
|
||||||
val imageUrl =
|
val imageUrl =
|
||||||
audio.data.albumId?.let { albumId ->
|
audio.data.albumId?.let { albumId ->
|
||||||
imageUrlService.getItemImageUrl(
|
imageUrlService.getItemImageUrl(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue