diff --git a/src/components/application/ptplayer.vue b/src/components/application/ptplayer.vue index 75c82cca..b12c3fdc 100644 --- a/src/components/application/ptplayer.vue +++ b/src/components/application/ptplayer.vue @@ -76,8 +76,8 @@ - Manual sync - Playback Settings + Manual sync + Playback Settings Stop playback @@ -225,7 +225,6 @@ export default { }, chosenAudioTrackIndex: function () { // console.log('Audio track change') - var that = this let audioStreamID = this.playingMetadata.Media[this.chosenMediaIndex] .Part[0].Stream[this.chosenAudioTrackIndex].id let baseparams = this.getSourceByLabel(this.chosenQuality).params @@ -238,8 +237,7 @@ export default { 'X-Plex-Platform-Version': baseparams['X-Plex-Platform-Version'], 'X-Plex-Device': baseparams['X-Plex-Device'], 'X-Plex-Device-Name': baseparams['X-Plex-Device-Name'], - 'X-Plex-Device-Screen-Resolution': - baseparams['X-Plex-Device-Screen-Resolution'], + 'X-Plex-Device-Screen-Resolution': baseparams['X-Plex-Device-Screen-Resolution'], 'X-Plex-Token': baseparams['X-Plex-Token'] } var query = '' @@ -253,16 +251,15 @@ export default { method: 'PUT', url: url } - request(options, function (error, response, body) { + request(options, (error, response, body) => { if (!error) { - that.changedPlaying(false) + this.changedPlaying(false) } // console.log(error) }) }, chosenSubtitleIndex: function () { // console.log('Subtitle track change') - var that = this let subtitleStreamID = 0 if (this.chosenSubtitleIndex > -1) { subtitleStreamID = this.playingMetadata.Media[this.chosenMediaIndex].Part[0].Stream[this.chosenSubtitleIndex].id @@ -277,8 +274,7 @@ export default { 'X-Plex-Platform-Version': baseparams['X-Plex-Platform-Version'], 'X-Plex-Device': baseparams['X-Plex-Device'], 'X-Plex-Device-Name': baseparams['X-Plex-Device-Name'], - 'X-Plex-Device-Screen-Resolution': - baseparams['X-Plex-Device-Screen-Resolution'], + 'X-Plex-Device-Screen-Resolution': baseparams['X-Plex-Device-Screen-Resolution'], 'X-Plex-Token': baseparams['X-Plex-Token'] } var query = '' @@ -291,9 +287,9 @@ export default { method: 'PUT', url: url } - request(options, function (error, response, body) { + request(options, (error, response, body) => { if (!error) { - that.changedPlaying(false) + this.changedPlaying(false) } // console.log(error) }) @@ -403,7 +399,8 @@ export default { return null }, doManualSync: function () { - this.$store.commit('SET_VALUE', 'manualSyncQueued', true) + console.log('Setting manual sync to true') + this.$store.commit('SET_VALUE', ['manualSyncQueued', true]) }, openModal () { return this.$refs.playersettingsModal.open() diff --git a/src/store/modules/synclounge.js b/src/store/modules/synclounge.js index 1f3c9944..c0a88b45 100644 --- a/src/store/modules/synclounge.js +++ b/src/store/modules/synclounge.js @@ -317,6 +317,14 @@ export default { if we need to seek or start playing something. */ rootState.hostClientResponseTime = data.clientResponseTime + if (rootState.manualSyncQueued) { + state.decisionBlocked = new Date().getTime() + window.EventBus.$emit('host-playerstate-change') + await rootState.chosenClient.seekTo(hostTimeline.time) + rootState.manualSyncQueued = false + state.decisionBlocked = 0 + return + } if (Math.abs(state.decisionBlocked - new Date().getTime()) < 90000) { console.log('We are not going to make a decision from the host data because a command is already running') return @@ -350,7 +358,6 @@ export default { console.log('Error caught in sync logic', e) state.decisionBlocked = 0 } - state.decisionBlocked = 0 }) state._socket.on('disconnect', function (data) {