mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
fix: Respect USE_HLS_OVER_DASH preference when playing in audio mode
This commit is contained in:
parent
ff7de41ad1
commit
ddcdfbad68
@ -27,6 +27,7 @@ import com.github.libretube.api.RetrofitInstance
|
||||
import com.github.libretube.api.obj.Segment
|
||||
import com.github.libretube.api.obj.Streams
|
||||
import com.github.libretube.constants.IntentData
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.db.DatabaseHelper
|
||||
import com.github.libretube.enums.NotificationId
|
||||
import com.github.libretube.extensions.parcelableExtra
|
||||
@ -35,6 +36,7 @@ import com.github.libretube.extensions.toID
|
||||
import com.github.libretube.extensions.updateParameters
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
import com.github.libretube.helpers.PlayerHelper.checkForSegments
|
||||
import com.github.libretube.helpers.PreferenceHelper
|
||||
import com.github.libretube.helpers.ProxyHelper
|
||||
import com.github.libretube.obj.PlayerNotificationData
|
||||
import com.github.libretube.parcelable.PlayerData
|
||||
@ -325,14 +327,19 @@ class OnlinePlayerService : LifecycleService() {
|
||||
private suspend fun setMediaItem() {
|
||||
val streams = streams ?: return
|
||||
|
||||
val (uri, mimeType) = if (streams.audioStreams.isNotEmpty() && !PlayerHelper.disablePipedProxy) {
|
||||
PlayerHelper.createDashSource(
|
||||
streams,
|
||||
this
|
||||
) to MimeTypes.APPLICATION_MPD
|
||||
} else {
|
||||
ProxyHelper.unwrapStreamUrl(streams.hls.orEmpty()).toUri() to MimeTypes.APPLICATION_M3U8
|
||||
}
|
||||
val (uri, mimeType) =
|
||||
if (!PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.USE_HLS_OVER_DASH,
|
||||
false,
|
||||
) && streams.audioStreams.isNotEmpty() && !PlayerHelper.disablePipedProxy
|
||||
) {
|
||||
PlayerHelper.createDashSource(
|
||||
streams,
|
||||
this,
|
||||
) to MimeTypes.APPLICATION_MPD
|
||||
} else {
|
||||
ProxyHelper.unwrapStreamUrl(streams.hls.orEmpty()).toUri() to MimeTypes.APPLICATION_M3U8
|
||||
}
|
||||
|
||||
val mediaItem = MediaItem.Builder()
|
||||
.setUri(uri)
|
||||
|
Loading…
Reference in New Issue
Block a user