added playlist next video interval (#1006)

This commit is contained in:
Sai Deepesh 2021-03-06 21:55:50 +05:30 committed by GitHub
parent 9d4ea68e89
commit 3b75a97859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 5 deletions

View File

@ -62,6 +62,10 @@ export default Vue.extend({
return this.$store.getters.getProxyVideos
},
defaultInterval: function () {
return parseInt(this.$store.getters.getDefaultInterval)
},
defaultVolume: function () {
return parseFloat(this.$store.getters.getDefaultVolume) * 100
},
@ -119,6 +123,7 @@ export default Vue.extend({
'updateForceLocalBackendForLegacy',
'updateProxyVideos',
'updateDefaultTheatreMode',
'updateDefaultInterval',
'updateDefaultVolume',
'updateDefaultPlayback',
'updateDefaultVideoFormat',

View File

@ -61,6 +61,15 @@
</div>
</div>
<ft-flex-box>
<ft-slider
:label="$t('Settings.Player Settings.Playlist Next Video Interval')"
:default-value="defaultInterval"
:min-value="0"
:max-value="60"
:step="1"
value-extension="s"
@change="updateDefaultInterval"
/>
<ft-slider
:label="$t('Settings.Player Settings.Default Volume')"
:default-value="defaultVolume"

View File

@ -54,6 +54,7 @@ const state = {
forceLocalBackendForLegacy: false,
proxyVideos: false,
defaultTheatreMode: false,
defaultInterval: 5,
defaultVolume: 1,
defaultPlayback: 1,
defaultVideoFormat: 'dash',
@ -184,6 +185,10 @@ const getters = {
return state.defaultTheatreMode
},
getDefaultInterval: () => {
return state.defaultInterval
},
getDefaultVolume: () => {
return state.defaultVolume
},
@ -356,6 +361,9 @@ const actions = {
case 'defaultTheatreMode':
commit('setDefaultTheatreMode', result.value)
break
case 'defaultInterval':
commit('setDefaultInterval', result.value)
break
case 'defaultVolume':
commit('setDefaultVolume', result.value)
sessionStorage.setItem('volume', result.value)
@ -598,6 +606,14 @@ const actions = {
})
},
updateDefaultInterval ({ commit }, defaultInterval) {
settingsDb.update({ _id: 'defaultInterval' }, { _id: 'defaultInterval', value: defaultInterval }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultInterval', defaultInterval)
}
})
},
updateDefaultVolume ({ commit }, defaultVolume) {
settingsDb.update({ _id: 'defaultVolume' }, { _id: 'defaultVolume', value: defaultVolume }, { upsert: true }, (err, numReplaced) => {
if (!err) {
@ -819,6 +835,9 @@ const mutations = {
setProxyVideos (state, proxyVideos) {
state.proxyVideos = proxyVideos
},
setDefaultInterval (state, defaultInterval) {
state.defaultInterval = defaultInterval
},
setDefaultVolume (state, defaultVolume) {
state.defaultVolume = defaultVolume
},

View File

@ -105,6 +105,9 @@ export default Vue.extend({
proxyVideos: function () {
return this.$store.getters.getProxyVideos
},
defaultInterval: function () {
return this.$store.getters.getDefaultInterval
},
defaultTheatreMode: function () {
return this.$store.getters.getDefaultTheatreMode
},
@ -808,14 +811,15 @@ export default Vue.extend({
},
handleVideoEnded: function () {
const nextVideoInterval = this.defaultInterval
if (this.watchingPlaylist) {
this.playNextTimeout = setTimeout(() => {
this.$refs.watchVideoPlaylist.playNextVideo()
}, 5000)
}, nextVideoInterval * 1000)
this.showToast({
message: this.$t('Playing next video in 5 seconds. Click to cancel'),
time: 5500,
message: this.$tc('Playing Next Video Interval', nextVideoInterval, { nextVideoInterval: nextVideoInterval }),
time: (nextVideoInterval * 1000) + 500,
action: () => {
clearTimeout(this.playNextTimeout)
this.showToast({

View File

@ -171,6 +171,7 @@ Settings:
Proxy Videos Through Invidious: Proxy Videos Through Invidious
Autoplay Playlists: Autoplay Playlists
Enable Theatre Mode by Default: Enable Theatre Mode by Default
Playlist Next Video Interval: Playlist Next Video Interval
Default Volume: Default Volume
Default Playback Rate: Default Playback Rate
Default Video Format:
@ -586,8 +587,7 @@ Shuffle is now enabled: Shuffle is now enabled
The playlist has been reversed: The playlist has been reversed
Playing Next Video: Playing Next Video
Playing Previous Video: Playing Previous Video
Playing next video in 5 seconds. Click to cancel: Playing next video in 5 seconds.
Click to cancel.
Playing Next Video Interval: Playing next video in no time. Click to cancel. | Playing next video in {nextVideoInterval} second. Click to cancel. | Playing next video in {nextVideoInterval} seconds. Click to cancel.
Canceled next video autoplay: Canceled next video autoplay
'The playlist has ended. Enable loop to continue playing': 'The playlist has ended. Enable
loop to continue playing'