From 162505c75ecc7a73b7007ea4c8aaff18695df716 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 19 May 2018 16:24:36 +1000 Subject: [PATCH] SLPlayer immediate updates --- src/components/application/ptplayer.vue | 29 ++++++++++++++++++- .../application/ptplayer/videoplayer.vue | 4 +-- src/sidebar.vue | 2 +- src/stylus/main.styl | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/components/application/ptplayer.vue b/src/components/application/ptplayer.vue index c284067a..cbe6cb5b 100644 --- a/src/components/application/ptplayer.vue +++ b/src/components/application/ptplayer.vue @@ -144,6 +144,7 @@ export default { duration: this.playerduration, state: this.playerstatus } + this.lastSentTimeline = playerdata return data.callback(playerdata) } if (data.command === '/player/playback/play') { @@ -227,7 +228,9 @@ export default { // Browser browser: this.getBrowser(), dialog: false, - destroyed: false + destroyed: false, + + lastSentTimeline: {} } }, watch: { @@ -601,6 +604,30 @@ export default { this.playerstatus = data.status this.bufferedTill = data.bufferedTill this.playerduration = data.duration + + if (this.lastSentTimeline.state !== data.status || this.chosenKey !== this.lastSentTimeline.key) { + let key = this.chosenKey + let ratingKey = null + if (key) { + ratingKey = '/library/metadata/' + key + } + let machineIdentifier = null + if (this.chosenServer) { + machineIdentifier = this.chosenServer.clientIdentifier + } + let playerdata = { + key: key, + ratingKey: ratingKey, + time: this.playertime, + type: 'video', + machineIdentifier: machineIdentifier, + duration: this.playerduration, + state: this.playerstatus + } + this.lastSentTimeline = playerdata + console.log('Emitting an immediate change') + this.chosenClient.updateTimelineObject(playerdata) + } }, playerSeekDone (data) {}, generateTranscodeUrl (overrideparams) { diff --git a/src/components/application/ptplayer/videoplayer.vue b/src/components/application/ptplayer/videoplayer.vue index c912d064..861d5b77 100644 --- a/src/components/application/ptplayer/videoplayer.vue +++ b/src/components/application/ptplayer/videoplayer.vue @@ -382,9 +382,9 @@ export default { }, playerStateChanged (playerCurrentState) { // console.log("Setting volume to " + this.player.volume() || 0) - this.$store.commit('setSettingPTPLAYERVOLUME', this.player.volume() || 0) + this.$store.commit('setSetting', ['PTPLAYERVOLUME', this.player.volume() || 0]) this.bufferedTill = Math.round(this.player.buffered().end(0) * 1000) - this.duration = Math.round(this.player.duration() * 1000) + this.duration = Math.round(this.player.duration() * 1000) this.bufferStart = Math.round(this.player.buffered().start(0) * 1000) this.bufferEnd = Math.round(this.player.buffered().end(0) * 1000) if (this.player.error_) { diff --git a/src/sidebar.vue b/src/sidebar.vue index 3c4428d2..86ca5684 100644 --- a/src/sidebar.vue +++ b/src/sidebar.vue @@ -32,7 +32,7 @@ - + {{ user.username }} (you) {{ getTitle(user) }} diff --git a/src/stylus/main.styl b/src/stylus/main.styl index d4fc7a57..622ef1aa 100644 --- a/src/stylus/main.styl +++ b/src/stylus/main.styl @@ -3,7 +3,7 @@ $theme := { primary: #E5A00D accent: $red.accent-2 - secondary: #F3B32B + secondary: #353e58 info: $blue.lighten-1 warning: $amber.darken-2 error: $red.accent-4