From 11b568d0b6276843df4955ceb630bca75db9555e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 30 Jul 2022 13:20:11 +0200 Subject: [PATCH] switch back to 1x speed on live stream end --- .../com/github/libretube/fragments/PlayerFragment.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 410edf4da..da2697bdd 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -957,7 +957,8 @@ class PlayerFragment : Fragment() { binding.apply { playerViewsInfo.text = context?.getString(R.string.views, response.views.formatShort()) + - " • " + response.uploadDate + if (!isLive) " • " + response.uploadDate else "" + textLike.text = response.likes.formatShort() textDislike.text = response.dislikes.formatShort() ConnectionHelper.loadImage(response.uploaderAvatar, binding.playerChannelImage) @@ -1018,8 +1019,13 @@ class PlayerFragment : Fragment() { !playWhenReady ) + // switch back to normal speed when on the end of live stream + if (isLive && (exoPlayer.duration - exoPlayer.duration < 0.5)) { + exoPlayer.setPlaybackSpeed(1F) + playerBinding.speedText.text = "1x" + } // check if video has ended, next video is available and autoplay is enabled. - if ( + else if ( playbackState == Player.STATE_ENDED && nextStreamId != null && !transitioning &&