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

View File

@ -94,6 +94,10 @@ export default Vue.extend({
return this.$store.getters.getVideoVolumeMouseScroll
},
displayVideoPlayButton: function () {
return this.$store.getters.getDisplayVideoPlayButton
},
formatNames: function () {
return [
this.$t('Settings.Player Settings.Default Video Format.Dash Formats'),
@ -132,7 +136,8 @@ export default Vue.extend({
'updateDefaultPlayback',
'updateDefaultVideoFormat',
'updateDefaultQuality',
'updateVideoVolumeMouseScroll'
'updateVideoVolumeMouseScroll',
'updateDisplayVideoPlayButton'
])
}
})

View File

@ -43,6 +43,12 @@
:default-value="videoVolumeMouseScroll"
@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 class="switchColumn">
<ft-toggle-switch

View File

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

View File

@ -174,6 +174,7 @@ Settings:
Autoplay Playlists: Autoplay Playlists
Enable Theatre Mode by Default: Enable Theatre Mode by Default
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
Default Volume: Default Volume
Default Playback Rate: Default Playback Rate