Update cast button on fullscreen player

This commit is contained in:
advplyr 2022-04-17 18:14:45 -05:00
parent c4c6377925
commit 13665af0ed
3 changed files with 16 additions and 3 deletions

View file

@ -39,11 +39,18 @@ import { AbsAudioPlayer } from '@/plugins/capacitor'
export default { export default {
data() { data() {
return { return {
onCastAvailableUpdateListener: null, onCastAvailableUpdateListener: null
isCastAvailable: false
} }
}, },
computed: { computed: {
isCastAvailable: {
get() {
return this.$store.state.isCastAvailable
},
set(val) {
this.$store.commit('setCastAvailable', val)
}
},
socketConnected() { socketConnected() {
return this.$store.state.socketConnected return this.$store.state.socketConnected
}, },

View file

@ -109,7 +109,6 @@ export default {
return { return {
playbackSession: null, playbackSession: null,
showChapterModal: false, showChapterModal: false,
showCastBtn: true,
showFullscreen: false, showFullscreen: false,
totalDuration: 0, totalDuration: 0,
currentPlaybackRate: 1, currentPlaybackRate: 1,
@ -159,6 +158,9 @@ export default {
} }
return this.showFullscreen ? 200 : 60 return this.showFullscreen ? 200 : 60
}, },
showCastBtn() {
return this.$store.state.isCastAvailable && !this.isLocalPlayMethod
},
isCasting() { isCasting() {
return this.mediaPlayer === 'cast-player' return this.mediaPlayer === 'cast-player'
}, },

View file

@ -6,6 +6,7 @@ export const state = () => ({
playerIsLocal: false, playerIsLocal: false,
playerIsPlaying: false, playerIsPlaying: false,
isCasting: false, isCasting: false,
isCastAvailable: false,
appUpdateInfo: null, appUpdateInfo: null,
socketConnected: false, socketConnected: false,
networkConnected: false, networkConnected: false,
@ -76,6 +77,9 @@ export const mutations = {
setMediaPlayer(state, mediaPlayer) { setMediaPlayer(state, mediaPlayer) {
state.isCasting = mediaPlayer === 'cast-player' state.isCasting = mediaPlayer === 'cast-player'
}, },
setCastAvailable(state, available) {
state.isCastAvailable = available
},
setPlayerPlaying(state, val) { setPlayerPlaying(state, val) {
state.playerIsPlaying = val state.playerIsPlaying = val
}, },