Setting to enable and disable display of video play button (#1370)

* Added setting to toggle play button in video player

* Fixed wrong way around boolean check

* Fixed setting not loading on startup
This commit is contained in:
Luca Hohmann 2021-05-29 20:35:28 +02:00 committed by GitHub
parent 26f7e7aa4f
commit 5f1818ee91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 4 deletions

View File

@ -165,6 +165,10 @@ export default Vue.extend({
sponsorBlockShowSkippedToast: function () { sponsorBlockShowSkippedToast: function () {
return this.$store.getters.getSponsorBlockShowSkippedToast return this.$store.getters.getSponsorBlockShowSkippedToast
},
displayVideoPlayButton: function() {
return this.$store.getters.getDisplayVideoPlayButton
} }
}, },
mounted: function () { mounted: function () {
@ -223,7 +227,9 @@ export default Vue.extend({
this.player.playbackRate(this.defaultPlayback) this.player.playbackRate(this.defaultPlayback)
// Remove big play button // Remove big play button
// https://github.com/videojs/video.js/blob/v7.12.1/docs/guides/components.md#basic-example // https://github.com/videojs/video.js/blob/v7.12.1/docs/guides/components.md#basic-example
if (!this.displayVideoPlayButton) {
this.player.removeChild('BigPlayButton') this.player.removeChild('BigPlayButton')
}
if (this.storyboardSrc !== '') { if (this.storyboardSrc !== '') {
this.player.vttThumbnails({ this.player.vttThumbnails({

View File

@ -94,6 +94,10 @@ export default Vue.extend({
return this.$store.getters.getVideoVolumeMouseScroll return this.$store.getters.getVideoVolumeMouseScroll
}, },
displayVideoPlayButton: function () {
return this.$store.getters.getDisplayVideoPlayButton
},
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'),
@ -132,7 +136,8 @@ export default Vue.extend({
'updateDefaultPlayback', 'updateDefaultPlayback',
'updateDefaultVideoFormat', 'updateDefaultVideoFormat',
'updateDefaultQuality', 'updateDefaultQuality',
'updateVideoVolumeMouseScroll' 'updateVideoVolumeMouseScroll',
'updateDisplayVideoPlayButton'
]) ])
} }
}) })

View File

@ -43,6 +43,12 @@
:default-value="videoVolumeMouseScroll" :default-value="videoVolumeMouseScroll"
@change="updateVideoVolumeMouseScroll" @change="updateVideoVolumeMouseScroll"
/> />
<ft-toggle-switch
:label="$t('Settings.Player Settings.Display Play Button In Video Player')"
:compact="true"
:default-value="displayVideoPlayButton"
@change="updateDisplayVideoPlayButton"
/>
</div> </div>
<div class="switchColumn"> <div class="switchColumn">
<ft-toggle-switch <ft-toggle-switch

View File

@ -80,7 +80,8 @@ const state = {
videoVolumeMouseScroll: false, videoVolumeMouseScroll: false,
useSponsorBlock: false, useSponsorBlock: false,
sponsorBlockUrl: 'https://sponsor.ajay.app', sponsorBlockUrl: 'https://sponsor.ajay.app',
sponsorBlockShowSkippedToast: true sponsorBlockShowSkippedToast: true,
displayVideoPlayButton: true
} }
const getters = { const getters = {
@ -272,6 +273,10 @@ const getters = {
return state.videoVolumeMouseScroll return state.videoVolumeMouseScroll
}, },
getDisplayVideoPlayButton: () => {
return state.displayVideoPlayButton
},
getUseSponsorBlock: () => { getUseSponsorBlock: () => {
return state.useSponsorBlock return state.useSponsorBlock
}, },
@ -304,7 +309,6 @@ const actions = {
commit('setBackendFallback', result.value) commit('setBackendFallback', result.value)
break break
case 'defaultProfile': case 'defaultProfile':
console.log('IN SETTING DEFAULT:', result.value)
commit('setDefaultProfile', result.value) commit('setDefaultProfile', result.value)
break break
case 'checkForUpdates': case 'checkForUpdates':
@ -448,6 +452,9 @@ const actions = {
break break
case 'sponsorBlockShowSkippedToast': case 'sponsorBlockShowSkippedToast':
commit('setSponsorBlockShowSkippedToast', result.value) commit('setSponsorBlockShowSkippedToast', result.value)
break
case 'displayVideoPlayButton':
commit('setDisplayVideoPlayButton', result.value)
} }
}) })
resolve() resolve()
@ -827,6 +834,14 @@ const actions = {
}) })
}, },
updateDisplayVideoPlayButton ({ commit }, displayVideoPlayButton) {
settingsDb.update({ _id: 'displayVideoPlayButton' }, { _id: 'displayVideoPlayButton', value: displayVideoPlayButton }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDisplayVideoPlayButton', displayVideoPlayButton)
}
})
},
updateUseSponsorBlock ({ commit }, useSponsorBlock) { updateUseSponsorBlock ({ commit }, useSponsorBlock) {
settingsDb.update({ _id: 'useSponsorBlock' }, { _id: 'useSponsorBlock', value: useSponsorBlock }, { upsert: true }, (err, numReplaced) => { settingsDb.update({ _id: 'useSponsorBlock' }, { _id: 'useSponsorBlock', value: useSponsorBlock }, { upsert: true }, (err, numReplaced) => {
if (!err) { if (!err) {
@ -1011,6 +1026,9 @@ const mutations = {
setVideoVolumeMouseScroll (state, videoVolumeMouseScroll) { setVideoVolumeMouseScroll (state, videoVolumeMouseScroll) {
state.videoVolumeMouseScroll = videoVolumeMouseScroll state.videoVolumeMouseScroll = videoVolumeMouseScroll
}, },
setDisplayVideoPlayButton (state, displayVideoPlayButton) {
state.displayVideoPlayButton = displayVideoPlayButton
},
setUseSponsorBlock (state, useSponsorBlock) { setUseSponsorBlock (state, useSponsorBlock) {
state.useSponsorBlock = useSponsorBlock state.useSponsorBlock = useSponsorBlock
}, },

View File

@ -174,6 +174,7 @@ Settings:
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
Scroll Volume Over Video Player: Scroll Volume Over Video Player Scroll Volume Over Video Player: Scroll Volume Over Video Player
Display Play Button In Video Player: Display Play Button In Video Player
Next Video Interval: Next Video Interval Next Video Interval: Next Video Interval
Default Volume: Default Volume Default Volume: Default Volume
Default Playback Rate: Default Playback Rate Default Playback Rate: Default Playback Rate