remove seekbar preview

This commit is contained in:
Bnyro 2022-08-09 14:18:16 +02:00
parent 781e1654cc
commit 2651f0e95b
4 changed files with 8 additions and 44 deletions

View File

@ -66,7 +66,11 @@ class MainActivity : BaseActivity() {
else ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
// start service that gets called on closure
startService(Intent(this, ClosingService::class.java))
try {
startService(Intent(this, ClosingService::class.java))
} catch (e: Exception) {
e.printStackTrace()
}
CronetHelper.initCronet(this.applicationContext)
ConnectionHelper.imageLoader = ImageLoader.Builder(this.applicationContext)

View File

@ -161,7 +161,6 @@ class PlayerFragment : BaseFragment() {
private var videoFormatPreference = "webm"
private var defRes = ""
private var bufferingGoal = 50000
private var seekBarPreview = false
private var defaultSubtitleCode = ""
private var sponsorBlockEnabled = true
private var sponsorBlockNotifications = true
@ -310,11 +309,6 @@ class PlayerFragment : BaseFragment() {
"50"
).toInt() * 1000
seekBarPreview = PreferenceHelper.getBoolean(
PreferenceKeys.SEEKBAR_PREVIEW,
false
)
sponsorBlockEnabled = PreferenceHelper.getBoolean(
"sb_enabled_key",
true
@ -599,12 +593,12 @@ class PlayerFragment : BaseFragment() {
// probably a youtube shorts video
if (videoSize.height > videoSize.width) ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
// a video with normal aspect ratio
else ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
else ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
}
"auto" -> ActivityInfo.SCREEN_ORIENTATION_SENSOR
"landscape" -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
"landscape" -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
"portrait" -> ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
else -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
else -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
}
mainActivity.requestedOrientation = orientation
}
@ -915,7 +909,6 @@ class PlayerFragment : BaseFragment() {
playerBinding.exoTitle.text = response.title
if (seekBarPreview) enableSeekbarPreview()
enableDoubleTapToSeek()
// init the chapters recyclerview
@ -1173,31 +1166,6 @@ class PlayerFragment : BaseFragment() {
}
}
// enable seek bar preview
private fun enableSeekbarPreview() {
playerBinding.exoProgress.addListener(object : TimeBar.OnScrubListener {
override fun onScrubStart(timeBar: TimeBar, position: Long) {
exoPlayer.pause()
}
override fun onScrubMove(timeBar: TimeBar, position: Long) {
val minTimeDiff = 10 * 1000 // 10s
// get the difference between the new and the old position
val diff = abs(exoPlayer.currentPosition - position)
// seek only when the difference is greater than 10 seconds
if (diff >= minTimeDiff) exoPlayer.seekTo(position)
}
override fun onScrubStop(timeBar: TimeBar, position: Long, canceled: Boolean) {
exoPlayer.seekTo(position)
exoPlayer.play()
Handler(Looper.getMainLooper()).postDelayed({
exoPlayerView.hideController()
}, 200)
}
})
}
private fun initializeChapters() {
if (chapters.isNotEmpty()) {
// enable chapters in the video description

View File

@ -54,7 +54,6 @@ object PreferenceKeys {
const val PLAYER_VIDEO_FORMAT = "player_video_format"
const val DEFAULT_RESOLUTION = "default_res"
const val BUFFERING_GOAL = "buffering_goal"
const val SEEKBAR_PREVIEW = "seekbar_preview"
const val PLAYER_AUDIO_FORMAT = "player_audio_format"
const val PLAYER_AUDIO_QUALITY = "player_audio_quality"
const val DEFAULT_SUBTITLE = "default_subtitle"

View File

@ -102,13 +102,6 @@
app:key="pause_screen_off"
app:title="@string/pauseOnScreenOff" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:icon="@drawable/ic_visibility"
android:summary="@string/seekbar_preview_summary"
android:title="@string/seekbar_preview"
app:key="seekbar_preview" />
<SwitchPreferenceCompat
android:icon="@drawable/ic_rotating_circle"
android:summary="@string/autoRotatePlayer_summary"