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

View File

@ -61,6 +61,15 @@
</div> </div>
</div> </div>
<ft-flex-box> <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 <ft-slider
:label="$t('Settings.Player Settings.Default Volume')" :label="$t('Settings.Player Settings.Default Volume')"
:default-value="defaultVolume" :default-value="defaultVolume"

View File

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

View File

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

View File

@ -171,6 +171,7 @@ Settings:
Proxy Videos Through Invidious: Proxy Videos Through Invidious Proxy Videos Through Invidious: Proxy Videos Through Invidious
Autoplay Playlists: Autoplay Playlists Autoplay Playlists: Autoplay Playlists
Enable Theatre Mode by Default: Enable Theatre Mode by Default Enable Theatre Mode by Default: Enable Theatre Mode by Default
Playlist Next Video Interval: Playlist Next Video Interval
Default Volume: Default Volume Default Volume: Default Volume
Default Playback Rate: Default Playback Rate Default Playback Rate: Default Playback Rate
Default Video Format: 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 The playlist has been reversed: The playlist has been reversed
Playing Next Video: Playing Next Video Playing Next Video: Playing Next Video
Playing Previous Video: Playing Previous Video Playing Previous Video: Playing Previous Video
Playing next video in 5 seconds. Click to cancel: Playing next video in 5 seconds. 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.
Click to cancel.
Canceled next video autoplay: Canceled next video autoplay Canceled next video autoplay: Canceled next video autoplay
'The playlist has ended. Enable loop to continue playing': 'The playlist has ended. Enable 'The playlist has ended. Enable loop to continue playing': 'The playlist has ended. Enable
loop to continue playing' loop to continue playing'