mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
Merge pull request #2753 from Bnyro/master
Fix that skip silence is enabled by default
This commit is contained in:
commit
d5d36101c7
@ -91,8 +91,6 @@ class OfflinePlayerActivity : BaseActivity() {
|
||||
finish()
|
||||
}
|
||||
|
||||
PlayerHelper.applyCaptionsStyle(this, playerView.subtitleView)
|
||||
|
||||
binding.player.initialize(
|
||||
null,
|
||||
binding.doubleTapOverlay.binding,
|
||||
|
@ -826,8 +826,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
||||
}
|
||||
|
||||
playerBinding.exoProgress.setPlayer(exoPlayer)
|
||||
|
||||
PlayerHelper.applyCaptionsStyle(requireContext(), exoPlayerView.subtitleView)
|
||||
}
|
||||
|
||||
private fun localizedDate(date: String?): String? {
|
||||
|
@ -38,8 +38,10 @@ import com.github.libretube.util.PreferenceHelper
|
||||
import com.google.android.exoplayer2.ExoPlayer
|
||||
import com.google.android.exoplayer2.PlaybackParameters
|
||||
import com.google.android.exoplayer2.Player
|
||||
import com.google.android.exoplayer2.text.Cue
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelector
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
|
||||
import com.google.android.exoplayer2.ui.CaptionStyleCompat
|
||||
import com.google.android.exoplayer2.ui.StyledPlayerView
|
||||
import com.google.android.exoplayer2.ui.SubtitleView
|
||||
import com.google.android.exoplayer2.util.RepeatModeUtil
|
||||
@ -106,7 +108,7 @@ internal class CustomExoPlayerView(
|
||||
initializeGestureProgress()
|
||||
|
||||
initRewindAndForward()
|
||||
|
||||
applyCaptionsStyle()
|
||||
initializeAdvancedOptions(context)
|
||||
|
||||
if (!playbackPrefSet) {
|
||||
@ -115,7 +117,7 @@ internal class CustomExoPlayerView(
|
||||
1.0f
|
||||
)
|
||||
PreferenceHelper.getBoolean(PreferenceKeys.SKIP_SILENCE, false).let {
|
||||
(player as ExoPlayer).skipSilenceEnabled = true
|
||||
(player as ExoPlayer).skipSilenceEnabled = it
|
||||
}
|
||||
playbackPrefSet = true
|
||||
}
|
||||
@ -569,6 +571,20 @@ internal class CustomExoPlayerView(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the captions style according to the users preferences
|
||||
*/
|
||||
fun applyCaptionsStyle() {
|
||||
val captionStyle = PlayerHelper.getCaptionStyle(context)
|
||||
subtitleView?.apply {
|
||||
setApplyEmbeddedFontSizes(false)
|
||||
setFixedTextSize(Cue.TEXT_SIZE_TYPE_ABSOLUTE, PlayerHelper.captionsTextSize)
|
||||
if (!PlayerHelper.useSystemCaptionStyle) return
|
||||
setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT)
|
||||
setStyle(captionStyle)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSingleTap() {
|
||||
toggleController()
|
||||
}
|
||||
|
@ -16,9 +16,7 @@ import com.github.libretube.api.obj.PipedStream
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.enums.AudioQuality
|
||||
import com.github.libretube.enums.PlayerEvent
|
||||
import com.google.android.exoplayer2.text.Cue
|
||||
import com.google.android.exoplayer2.ui.CaptionStyleCompat
|
||||
import com.google.android.exoplayer2.ui.SubtitleView
|
||||
import com.google.android.exoplayer2.video.VideoSize
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@ -431,18 +429,4 @@ object PlayerHelper {
|
||||
arrayListOf(rewindAction, playPauseAction, forwardAction)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the captions style according to the users preferences
|
||||
*/
|
||||
fun applyCaptionsStyle(context: Context, subtitleView: SubtitleView?) {
|
||||
val captionStyle = getCaptionStyle(context)
|
||||
subtitleView?.apply {
|
||||
setApplyEmbeddedFontSizes(false)
|
||||
setFixedTextSize(Cue.TEXT_SIZE_TYPE_ABSOLUTE, captionsTextSize)
|
||||
if (!useSystemCaptionStyle) return
|
||||
setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT)
|
||||
setStyle(captionStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user