mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
feat(player): play music at 1x speed (#4634)
Co-authored-by: Bnyro <82752168+Bnyro@users.noreply.github.com>
This commit is contained in:
parent
d4e10c55d6
commit
85ba045539
@ -91,4 +91,8 @@ data class Streams(
|
||||
shortDescription = description
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val categoryMusic = "Music"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import java.time.Instant
|
||||
import java.util.UUID
|
||||
|
||||
object PreferenceHelper {
|
||||
/**
|
||||
|
@ -101,7 +101,6 @@ import com.github.libretube.ui.adapters.VideosAdapter
|
||||
import com.github.libretube.ui.dialogs.AddToPlaylistDialog
|
||||
import com.github.libretube.ui.dialogs.DownloadDialog
|
||||
import com.github.libretube.ui.dialogs.ShareDialog
|
||||
import com.github.libretube.ui.sheets.StatsSheet
|
||||
import com.github.libretube.ui.extensions.setupSubscriptionButton
|
||||
import com.github.libretube.ui.interfaces.OnlinePlayerOptions
|
||||
import com.github.libretube.ui.listeners.SeekbarPreviewListener
|
||||
@ -111,6 +110,7 @@ import com.github.libretube.ui.sheets.BaseBottomSheet
|
||||
import com.github.libretube.ui.sheets.ChaptersBottomSheet
|
||||
import com.github.libretube.ui.sheets.CommentsSheet
|
||||
import com.github.libretube.ui.sheets.PlayingQueueSheet
|
||||
import com.github.libretube.ui.sheets.StatsSheet
|
||||
import com.github.libretube.util.HtmlParser
|
||||
import com.github.libretube.util.LinkHandler
|
||||
import com.github.libretube.util.NowPlayingNotification
|
||||
@ -938,6 +938,12 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
||||
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||
saveWatchPosition()
|
||||
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
if (streams.category == Streams.categoryMusic) {
|
||||
exoPlayer.setPlaybackSpeed(1f)
|
||||
}
|
||||
}
|
||||
|
||||
// set the playback speed to one if having reached the end of a livestream
|
||||
if (playbackState == Player.STATE_BUFFERING && binding.player.isLive &&
|
||||
exoPlayer.duration - exoPlayer.currentPosition < 700
|
||||
|
@ -7,7 +7,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import com.github.libretube.databinding.DialogStatsBinding
|
||||
import com.github.libretube.ui.sheets.ExpandedBottomSheet
|
||||
import com.github.libretube.util.TextUtils
|
||||
|
||||
class StatsSheet(
|
||||
|
Loading…
Reference in New Issue
Block a user