mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Reduce the amount of used data in background mode
This commit is contained in:
parent
2302515c26
commit
e021a52dbc
@ -293,22 +293,23 @@ class BackgroundMode : Service() {
|
||||
* Sets the [MediaItem] with the [streams] into the [player]
|
||||
*/
|
||||
private fun setMediaItem() {
|
||||
streams?.let {
|
||||
val uri = if (streams!!.hls != null) {
|
||||
streams!!.hls
|
||||
} else if (streams!!.audioStreams!!.isNotEmpty()) {
|
||||
PlayerHelper.getAudioSource(
|
||||
this,
|
||||
streams!!.audioStreams!!
|
||||
)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
val mediaItem = MediaItem.Builder()
|
||||
.setUri(uri)
|
||||
.build()
|
||||
player?.setMediaItem(mediaItem)
|
||||
streams ?: return
|
||||
|
||||
val uri = if (streams!!.audioStreams.orEmpty().isNotEmpty()) {
|
||||
PlayerHelper.getAudioSource(
|
||||
this,
|
||||
streams!!.audioStreams!!
|
||||
)
|
||||
} else if (streams!!.hls != null) {
|
||||
streams!!.hls
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
val mediaItem = MediaItem.Builder()
|
||||
.setUri(uri)
|
||||
.build()
|
||||
player?.setMediaItem(mediaItem)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -323,10 +323,14 @@ internal class CustomExoPlayerView(
|
||||
|
||||
// hide the dimming background overlay if locked
|
||||
binding.exoControlsBackground.setBackgroundColor(
|
||||
if (isLocked) ContextCompat.getColor(
|
||||
context,
|
||||
com.google.android.exoplayer2.R.color.exo_black_opacity_60
|
||||
) else Color.TRANSPARENT
|
||||
if (isLocked) {
|
||||
ContextCompat.getColor(
|
||||
context,
|
||||
com.google.android.exoplayer2.R.color.exo_black_opacity_60
|
||||
)
|
||||
} else {
|
||||
Color.TRANSPARENT
|
||||
}
|
||||
)
|
||||
|
||||
// disable tap and swipe gesture if the player is locked
|
||||
|
Loading…
x
Reference in New Issue
Block a user