Customize max playback rate and playback rate interval

This commit is contained in:
PrestonN 2022-04-10 18:00:47 -04:00
parent cf1790d52c
commit 40699b9ae3
5 changed files with 64 additions and 19 deletions

View File

@ -126,21 +126,7 @@ export default Vue.extend({
'qualitySelector', 'qualitySelector',
'fullscreenToggle' 'fullscreenToggle'
] ]
}, }
playbackRates: [
0.25,
0.5,
0.75,
1,
1.25,
1.5,
1.75,
2,
2.25,
2.5,
2.75,
3
]
} }
} }
}, },
@ -200,6 +186,27 @@ export default Vue.extend({
displayVideoPlayButton: function() { displayVideoPlayButton: function() {
return this.$store.getters.getDisplayVideoPlayButton return this.$store.getters.getDisplayVideoPlayButton
},
maxVideoPlaybackRate: function () {
return parseInt(this.$store.getters.getMaxVideoPlaybackRate)
},
videoPlaybackRateInterval: function () {
return parseFloat(this.$store.getters.getVideoPlaybackRateInterval)
},
playbackRates: function () {
const playbackRates = []
let i = this.videoPlaybackRateInterval
while (i <= this.maxVideoPlaybackRate) {
playbackRates.push(i)
i = i + this.videoPlaybackRateInterval
i = parseFloat(i.toFixed(2))
}
return playbackRates
} }
}, },
watch: { watch: {
@ -216,6 +223,8 @@ export default Vue.extend({
this.volume = volume this.volume = volume
} }
this.dataSetup.playbackRates = this.playbackRates
this.createFullWindowButton() this.createFullWindowButton()
this.createLoopButton() this.createLoopButton()
this.createToggleTheatreModeButton() this.createToggleTheatreModeButton()
@ -983,7 +992,7 @@ export default Vue.extend({
changePlayBackRate: function (rate) { changePlayBackRate: function (rate) {
const newPlaybackRate = (this.player.playbackRate() + rate).toFixed(2) const newPlaybackRate = (this.player.playbackRate() + rate).toFixed(2)
if (newPlaybackRate >= 0.25 && newPlaybackRate <= 8) { if (newPlaybackRate >= this.videoPlaybackRateInterval && newPlaybackRate <= this.maxVideoPlaybackRate) {
this.player.playbackRate(newPlaybackRate) this.player.playbackRate(newPlaybackRate)
} }
}, },
@ -1515,13 +1524,13 @@ export default Vue.extend({
// O Key // O Key
// Decrease playback rate by 0.25x // Decrease playback rate by 0.25x
event.preventDefault() event.preventDefault()
this.changePlayBackRate(-0.25) this.changePlayBackRate(-this.videoPlaybackRateInterval)
break break
case 80: case 80:
// P Key // P Key
// Increase playback rate by 0.25x // Increase playback rate by 0.25x
event.preventDefault() event.preventDefault()
this.changePlayBackRate(0.25) this.changePlayBackRate(this.videoPlaybackRateInterval)
break break
case 70: case 70:
// F Key // F Key

View File

@ -30,6 +30,12 @@ export default Vue.extend({
480, 480,
720, 720,
1080 1080
],
playbackRateIntervalValues: [
0.1,
0.25,
0.5,
1
] ]
} }
}, },
@ -106,6 +112,14 @@ export default Vue.extend({
return this.$store.getters.getDisplayVideoPlayButton return this.$store.getters.getDisplayVideoPlayButton
}, },
maxVideoPlaybackRate: function () {
return parseInt(this.$store.getters.getMaxVideoPlaybackRate)
},
videoPlaybackRateInterval: function () {
return this.$store.getters.getVideoPlaybackRateInterval
},
formatNames: function () { formatNames: function () {
return [ return [
this.$t('Settings.Player Settings.Default Video Format.Dash Formats'), this.$t('Settings.Player Settings.Default Video Format.Dash Formats'),
@ -143,7 +157,9 @@ export default Vue.extend({
'updateDefaultQuality', 'updateDefaultQuality',
'updateVideoVolumeMouseScroll', 'updateVideoVolumeMouseScroll',
'updateVideoPlaybackRateMouseScroll', 'updateVideoPlaybackRateMouseScroll',
'updateDisplayVideoPlayButton' 'updateDisplayVideoPlayButton',
'updateMaxVideoPlaybackRate',
'updateVideoPlaybackRateInterval'
]) ])
} }
}) })

View File

@ -115,6 +115,22 @@
value-extension="×" value-extension="×"
@change="updateDefaultPlayback" @change="updateDefaultPlayback"
/> />
<ft-slider
:label="$t('Settings.Player Settings.Max Video Playback Rate')"
:default-value="maxVideoPlaybackRate"
:min-value="2"
:max-value="10"
:step="1"
value-extension="x"
@change="updateMaxVideoPlaybackRate"
/>
<ft-select
:placeholder="$t('Settings.Player Settings.Video Playback Rate Interval')"
:value="videoPlaybackRateInterval"
:select-names="playbackRateIntervalValues"
:select-values="playbackRateIntervalValues"
@change="updateVideoPlaybackRateInterval"
/>
</ft-flex-box> </ft-flex-box>
<ft-flex-box> <ft-flex-box>
<ft-select <ft-select

View File

@ -203,6 +203,7 @@ const state = {
hideLabelsSideBar: false, hideLabelsSideBar: false,
landingPage: 'subscriptions', landingPage: 'subscriptions',
listType: 'grid', listType: 'grid',
maxVideoPlaybackRate: 3,
playNextVideo: false, playNextVideo: false,
proxyHostname: '127.0.0.1', proxyHostname: '127.0.0.1',
proxyPort: '9050', proxyPort: '9050',
@ -220,6 +221,7 @@ const state = {
useSponsorBlock: false, useSponsorBlock: false,
videoVolumeMouseScroll: false, videoVolumeMouseScroll: false,
videoPlaybackRateMouseScroll: false, videoPlaybackRateMouseScroll: false,
videoPlaybackRateInterval: 0.25,
downloadFolderPath: '' downloadFolderPath: ''
} }

View File

@ -212,6 +212,8 @@ Settings:
Fast-Forward / Rewind Interval: Fast-Forward / Rewind Interval Fast-Forward / Rewind Interval: Fast-Forward / Rewind Interval
Default Volume: Default Volume Default Volume: Default Volume
Default Playback Rate: Default Playback Rate Default Playback Rate: Default Playback Rate
Max Video Playback Rate: Max Video Playback Rate
Video Playback Rate Interval: Video Playback Rate Interval
Default Video Format: Default Video Format:
Default Video Format: Default Video Format Default Video Format: Default Video Format
Dash Formats: DASH Formats Dash Formats: DASH Formats