Add Theatre Mode Toggle Setting and adjust video player side

This commit is contained in:
Preston 2020-04-21 22:59:09 -04:00
parent 8fade0c9c1
commit 1faa075a7b
7 changed files with 60 additions and 18 deletions

View File

@ -96,10 +96,6 @@ export default Vue.extend({
} }
}, },
computed: { computed: {
listType: function () {
return this.$store.getters.getListType
},
defaultPlayback: function () { defaultPlayback: function () {
return this.$store.getters.getDefaultPlayback return this.$store.getters.getDefaultPlayback
}, },
@ -112,6 +108,12 @@ export default Vue.extend({
return this.$store.getters.getAutoplayVideos return this.$store.getters.getAutoplayVideos
} }
}, },
watch: {
sourceList: function () {
console.log('Obtained Source list')
this.determineFormatType()
}
},
mounted: function () { mounted: function () {
this.id = this._uid this.id = this._uid
@ -199,7 +201,7 @@ export default Vue.extend({
this.useHls = false this.useHls = false
this.activeSourceList = this.dashSrc this.activeSourceList = this.dashSrc
setTimeout(this.initializePlayer, 1000) setTimeout(this.initializePlayer, 100)
}, },
enableLegacyFormat: function () { enableLegacyFormat: function () {

View File

@ -97,6 +97,10 @@ export default Vue.extend({
defaultQuality: function () { defaultQuality: function () {
return this.$store.getters.getDefaultQuality return this.$store.getters.getDefaultQuality
},
defaultTheatreMode: function () {
return this.$store.getters.getDefaultTheatreMode
} }
}, },
methods: { methods: {
@ -112,6 +116,7 @@ export default Vue.extend({
'updateEnableSubtitles', 'updateEnableSubtitles',
'updateForceLocalBackendForLegacy', 'updateForceLocalBackendForLegacy',
'updateProxyVideos', 'updateProxyVideos',
'updateDefaultTheatreMode',
'updateDefaultVolume', 'updateDefaultVolume',
'updateDefaultPlayback', 'updateDefaultPlayback',
'updateDefaultVideoFormat', 'updateDefaultVideoFormat',

View File

@ -10,25 +10,25 @@
<div class="switchColumn"> <div class="switchColumn">
<ft-toggle-switch <ft-toggle-switch
label="Remember History" label="Remember History"
:compact=true :compact="true"
:default-value="rememberHistory" :default-value="rememberHistory"
@change="updateRememberHistory" @change="updateRememberHistory"
/> />
<ft-toggle-switch <ft-toggle-switch
label="Enable Subtitles by Default" label="Enable Subtitles by Default"
:compact=true :compact="true"
:default-value="enableSubtitles" :default-value="enableSubtitles"
@change="updateEnableSubtitles" @change="updateEnableSubtitles"
/> />
<ft-toggle-switch <ft-toggle-switch
label="Force Local Backend for Legacy Formats" label="Force Local Backend for Legacy Formats"
:compact=true :compact="true"
:default-value="forceLocalBackendForLegacy" :default-value="forceLocalBackendForLegacy"
@change="updateForceLocalBackendForLegacy" @change="updateForceLocalBackendForLegacy"
/> />
<ft-toggle-switch <ft-toggle-switch
label="Proxy Videos Through Invidious" label="Proxy Videos Through Invidious"
:compact=true :compact="true"
:default-value="proxyVideos" :default-value="proxyVideos"
@change="updateProxyVideos" @change="updateProxyVideos"
/> />
@ -36,22 +36,28 @@
<div class="switchColumn"> <div class="switchColumn">
<ft-toggle-switch <ft-toggle-switch
label="Autoplay Videos" label="Autoplay Videos"
:compact=true :compact="true"
:default-value="autoplayVideos" :default-value="autoplayVideos"
@change="updateAutoplayVideos" @change="updateAutoplayVideos"
/> />
<ft-toggle-switch <ft-toggle-switch
label="Autoplay Playlists" label="Autoplay Playlists"
:compact=true :compact="true"
:default-value="autoplayPlaylists" :default-value="autoplayPlaylists"
@change="updateAutoplayPlaylists" @change="updateAutoplayPlaylists"
/> />
<ft-toggle-switch <ft-toggle-switch
label="Play Next Video" label="Play Next Video"
:compact=true :compact="true"
:default-value="playNextVideo" :default-value="playNextVideo"
@change="updatePlayNextVideo" @change="updatePlayNextVideo"
/> />
<ft-toggle-switch
label="Enable Theatre Mode by Default"
:compact="true"
:default-value="defaultTheatreMode"
@change="updateDefaultTheatreMode"
/>
</div> </div>
</div> </div>
<ft-flex-box> <ft-flex-box>

View File

@ -49,7 +49,7 @@
@click="navigate('userplaylists')" @click="navigate('userplaylists')"
> >
<font-awesome-icon <font-awesome-icon
icon="star" icon="bookmark"
class="navIcon" class="navIcon"
/> />
<p class="navLabel"> <p class="navLabel">

View File

@ -4,18 +4,23 @@ let dbLocation
if (window && window.process && window.process.type === 'renderer') { if (window && window.process && window.process.type === 'renderer') {
// Electron is being used // Electron is being used
let dbLocation = localStorage.getItem('dbLocation') /* let dbLocation = localStorage.getItem('dbLocation')
if (dbLocation === null) { if (dbLocation === null) {
const electron = require('electron') const electron = require('electron')
dbLocation = electron.remote.app.getPath('userData') dbLocation = electron.remote.app.getPath('userData')
} } */
dbLocation += '/settings.db' const electron = require('electron')
dbLocation = electron.remote.app.getPath('userData')
dbLocation = dbLocation + '/settings.db'
} else { } else {
dbLocation = 'settings.db' dbLocation = 'settings.db'
} }
console.log(dbLocation)
const settingsDb = new Datastore({ const settingsDb = new Datastore({
filename: dbLocation, filename: dbLocation,
autoload: true autoload: true
@ -39,6 +44,7 @@ const state = {
enableSubtitles: true, enableSubtitles: true,
forceLocalBackendForLegacy: true, forceLocalBackendForLegacy: true,
proxyVideos: false, proxyVideos: false,
defaultTheatreMode: false,
defaultVolume: 1, defaultVolume: 1,
defaultPlayback: 1, defaultPlayback: 1,
defaultVideoFormat: 'dash', defaultVideoFormat: 'dash',
@ -118,6 +124,10 @@ const getters = {
return state.proxyVideos return state.proxyVideos
}, },
getDefaultTheatreMode: () => {
return state.defaultTheatreMode
},
getDefaultVolume: () => { getDefaultVolume: () => {
return state.defaultVolume return state.defaultVolume
}, },
@ -191,6 +201,9 @@ const actions = {
case 'proxyVideos': case 'proxyVideos':
commit('setProxyVideos', result.value) commit('setProxyVideos', result.value)
break break
case 'defaultTheatreMode':
commit('setDefaultTheatreMode', 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)
@ -330,6 +343,14 @@ const actions = {
}) })
}, },
updateDefaultTheatreMode ({ commit }, defaultTheatreMode) {
settingsDb.update({ _id: 'defaultTheatreMode' }, { _id: 'defaultTheatreMode', value: defaultTheatreMode }, { upsert: true }, (err, numReplaced) => {
if (!err) {
commit('setDefaultTheatreMode', defaultTheatreMode)
}
})
},
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) {
@ -436,6 +457,9 @@ const mutations = {
setProxy (state, proxy) { setProxy (state, proxy) {
state.proxy = proxy state.proxy = proxy
}, },
setDefaultTheatreMode (state, defaultTheatreMode) {
state.defaultTheatreMode = defaultTheatreMode
},
setUseTor (state, useTor) { setUseTor (state, useTor) {
state.useTor = useTor state.useTor = useTor
}, },

View File

@ -21,7 +21,7 @@
} }
.theatrePlayer { .theatrePlayer {
width: calc(85% + 30px); width: 100%;
float: none; float: none;
margin: 0 auto; margin: 0 auto;
margin-bottom: 10px; margin-bottom: 10px;

View File

@ -26,7 +26,7 @@ export default Vue.extend({
return { return {
isLoading: false, isLoading: false,
firstLoad: true, firstLoad: true,
useTheatreMode: true, useTheatreMode: false,
showDashPlayer: true, showDashPlayer: true,
showLegacyPlayer: false, showLegacyPlayer: false,
showYouTubeNoCookieEmbed: false, showYouTubeNoCookieEmbed: false,
@ -72,6 +72,10 @@ export default Vue.extend({
return this.$store.getters.getProxyVideos return this.$store.getters.getProxyVideos
}, },
defaultTheatreMode: function () {
return this.$store.getters.getDefaultTheatreMode
},
defaultVideoFormat: function () { defaultVideoFormat: function () {
return this.$store.getters.getDefaultVideoFormat return this.$store.getters.getDefaultVideoFormat
}, },
@ -126,6 +130,7 @@ export default Vue.extend({
this.videoStoryboardSrc = `${this.invidiousInstance}/api/v1/storyboards/${this.videoId}?height=90` this.videoStoryboardSrc = `${this.invidiousInstance}/api/v1/storyboards/${this.videoId}?height=90`
this.activeFormat = this.defaultVideoFormat this.activeFormat = this.defaultVideoFormat
this.useTheatreMode = this.defaultTheatreMode
if (!this.usingElectron) { if (!this.usingElectron) {
this.getVideoInformationInvidious() this.getVideoInformationInvidious()