From 974545f0c89e7232771cd7f4db14b24e8ce714a5 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Thu, 18 Jun 2020 21:24:47 -0500 Subject: [PATCH] Update shaka and fix ui --- package-lock.json | 6 +++--- package.json | 2 +- .../application/plexbrowser/plexcontent.vue | 7 +++---- src/player/ui/closebutton.js | 2 +- src/player/ui/forward30button.js | 2 +- src/player/ui/replay10button.js | 2 +- src/store/modules/plexclients/actions.js | 15 ++++++++------- src/store/modules/plexservers/actions.js | 4 ++-- src/store/modules/slplayer/getters.js | 2 -- src/store/modules/synclounge/eventhandlers.js | 9 ++++----- src/store/modules/synclounge/mutations.js | 4 ++++ 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec4de7c2..1646886b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9968,9 +9968,9 @@ } }, "shaka-player": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shaka-player/-/shaka-player-3.0.0.tgz", - "integrity": "sha512-+ANlpyx5ZU10Z5XHD8QiqHgngVFFnJ9ZZhTOBORwGGIGRjI4sceMEHGVtz/kwjef63DSuro6XamASN5Zv56gMw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shaka-player/-/shaka-player-3.0.1.tgz", + "integrity": "sha512-sd//nbjJUlEZKRnGk6IBu0YW+Iw0ia8m5Zm4MxoL19VtDaiv0YuHo7ydFYkE3TcNOn++SCMQ+YntWtbNvRuQHw==", "dev": true, "requires": { "eme-encryption-scheme-polyfill": "^2.0.1" diff --git a/package.json b/package.json index 399b3196..dbadf186 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "lodash-es": "^4.17.15", "sass": "^1.26.7", "sass-loader": "^8.0.2", - "shaka-player": "^3.0.0", + "shaka-player": "^3.0.1", "socket.io-client": "^2.3.0", "string-similarity": "^4.0.1", "vanilla-tilt": "^1.7.0", diff --git a/src/components/application/plexbrowser/plexcontent.vue b/src/components/application/plexbrowser/plexcontent.vue index da77b0f8..32c04d51 100644 --- a/src/components/application/plexbrowser/plexcontent.vue +++ b/src/components/application/plexbrowser/plexcontent.vue @@ -631,7 +631,7 @@ export default { methods: { ...mapActions('plexclients', [ - 'PLEX_CLIENT_PLAY_MEDIA', + 'PLAY_MEDIA', ]), ...mapActions('plexservers', [ @@ -710,11 +710,10 @@ export default { offset = this.contents.viewOffset; } - await this.PLEX_CLIENT_PLAY_MEDIA({ - key: this.contents.key, + await this.PLAY_MEDIA({ metadata: this.contents, mediaIndex, - serverIdentifier: this.machineIdentifier, + machineIdentifier: this.machineIdentifier, offset, }); this.dialog = false; diff --git a/src/player/ui/closebutton.js b/src/player/ui/closebutton.js index f7bf36f6..8276a86d 100644 --- a/src/player/ui/closebutton.js +++ b/src/player/ui/closebutton.js @@ -9,7 +9,7 @@ class CloseButton extends shaka.ui.Element { // The actual button that will be displayed this.button = document.createElement('button'); this.button.classList.add('shaka-close-button'); - this.button.classList.add('material-icons'); + this.button.classList.add('material-icons-round'); this.button.textContent = 'close'; this.parent.appendChild(this.button); diff --git a/src/player/ui/forward30button.js b/src/player/ui/forward30button.js index 3075eb8a..0c20b5b1 100644 --- a/src/player/ui/forward30button.js +++ b/src/player/ui/forward30button.js @@ -9,7 +9,7 @@ class Forward30Button extends shaka.ui.Element { this.button = document.createElement('button'); this.button.classList.add('shaka-forward30-button'); this.button.classList.add('shaka-slplayer-button'); - this.button.classList.add('material-icons'); + this.button.classList.add('material-icons-round'); this.button.textContent = 'forward_30'; this.parent.appendChild(this.button); diff --git a/src/player/ui/replay10button.js b/src/player/ui/replay10button.js index 11225199..76bd3a31 100644 --- a/src/player/ui/replay10button.js +++ b/src/player/ui/replay10button.js @@ -9,7 +9,7 @@ class Replay10Button extends shaka.ui.Element { this.button = document.createElement('button'); this.button.classList.add('shaka-replay10-button'); this.button.classList.add('shaka-slplayer-button'); - this.button.classList.add('material-icons'); + this.button.classList.add('material-icons-round'); this.button.textContent = 'replay_10'; this.parent.appendChild(this.button); diff --git a/src/store/modules/plexclients/actions.js b/src/store/modules/plexclients/actions.js index 6d4293a0..6fdba7cd 100644 --- a/src/store/modules/plexclients/actions.js +++ b/src/store/modules/plexclients/actions.js @@ -37,16 +37,17 @@ export default { console.log('Updating timeline for', client, 'with', timeline); }, - PLEX_CLIENT_PLAY_MEDIA: async ({ getters, commit, rootGetters }, { - key, mediaIndex, metadata, serverIdentifier, offset, + PLAY_MEDIA: async ({ getters, commit, rootGetters }, { + mediaIndex, offset, metadata, machineIdentifier, }) => { - const server = rootGetters['plexservers/GET_PLEX_SERVER'](serverIdentifier); + const server = rootGetters['plexservers/GET_PLEX_SERVER'](machineIdentifier); if (getters.GET_CHOSEN_CLIENT_ID === 'PTPLAYER9PLUS10') { // do raw stuff // commit the proper stuff + commit('SET_ACTIVE_MEDIA_METADATA', metadata); - commit('SET_ACTIVE_SERVER_ID', serverIdentifier); + commit('SET_ACTIVE_SERVER_ID', machineIdentifier); commit('slplayer/SET_MEDIA_INDEX', mediaIndex, { root: true }); commit('slplayer/SET_OFFSET_MS', Math.round(offset) || 0, { root: true }); router.push('/player'); @@ -61,13 +62,13 @@ export default { const params = { 'X-Plex-Client-Identifier': 'SyncLounge', - key, + key: metadata.key, offset: Math.round(offset) || 0, - machineIdentifier: serverIdentifier, + machineIdentifier, address: server.chosenConnection.address, port: server.chosenConnection.port, protocol: server.chosenConnection.protocol, - path: server.chosenConnection.uri + key, + path: server.chosenConnection.uri + metadata.key, wait: 0, token: server.accessToken, }; diff --git a/src/store/modules/plexservers/actions.js b/src/store/modules/plexservers/actions.js index cfce0e22..6b9b6c37 100644 --- a/src/store/modules/plexservers/actions.js +++ b/src/store/modules/plexservers/actions.js @@ -133,13 +133,13 @@ export default { // If we have access the same server, play same content if (getters.IS_PLEX_SERVER_UNBLOCKED(hostTimeline.machineIdentifier)) { try { - await dispatch('FETCH_PLEX_METADATA', { + const metadata = await dispatch('FETCH_PLEX_METADATA', { ratingKey: hostTimeline.ratingKey, machineIdentifier: hostTimeline.machineIdentifier, }); return { - ratingKey: hostTimeline.ratingKey, + ...metadata, machineIdentifier: hostTimeline.machineIdentifier, mediaIndex: hostTimeline.mediaIndex, offset: hostTimeline.time, diff --git a/src/store/modules/slplayer/getters.js b/src/store/modules/slplayer/getters.js index a28b9db1..aba11feb 100644 --- a/src/store/modules/slplayer/getters.js +++ b/src/store/modules/slplayer/getters.js @@ -6,8 +6,6 @@ export default { GET_PLEX_DECISION: (state) => state.plexDecision, GET_PLEX_SERVER: (state, getters, rootState, rootGetters) => { - console.log(rootGetters['plexclients/GET_ACTIVE_SERVER_ID']); - console.log(rootGetters['plexservers/GET_PLEX_SERVER'](rootGetters['plexclients/GET_ACTIVE_SERVER_ID'])); return rootGetters['plexservers/GET_PLEX_SERVER'](rootGetters['plexclients/GET_ACTIVE_SERVER_ID']); }, diff --git a/src/store/modules/synclounge/eventhandlers.js b/src/store/modules/synclounge/eventhandlers.js index 57f47031..a45bd234 100644 --- a/src/store/modules/synclounge/eventhandlers.js +++ b/src/store/modules/synclounge/eventhandlers.js @@ -186,7 +186,6 @@ export default { if (getters.GET_HOST_TIMELINE.playerState === 'stopped' && timeline.playerState !== 'stopped') { // First, decide if we should stop playback dispatch('DISPLAY_NOTIFICATION', 'The host pressed stop', { root: true }); - await rootGetters.GET_CHOSEN_CLIENT.pressStop(); return dispatch('plexclients/PRESS_STOP', null, { root: true }); } @@ -226,13 +225,13 @@ export default { const bestMatch = await dispatch('plexservers/FIND_BEST_MEDIA_MATCH', getters.GET_HOST_TIMELINE, { root: true }); if (bestMatch) { - await dispatch('PLEX_CLIENT_PLAY_MEDIA', { + await dispatch('plexclients/PLAY_MEDIA', { // TODO: have timeline updates send out more info like mediaIdentifier etc - key: bestMatch.key, mediaIndex: bestMatch.mediaIndex || 0, - serverIdentifier: bestMatch.machineIdentifier, offset: getters.GET_HOST_TIMELINE.time || 0, - }); + metadata: bestMatch, + machineIdentifier: bestMatch.machineIdentifier, + }, { root: true }); } else { dispatch('DISPLAY_NOTIFICATION', `Failed to find a compatible copy of ${getters.GET_HOST_TIMELINE}. If you have access to the content try manually playing it.`, diff --git a/src/store/modules/synclounge/mutations.js b/src/store/modules/synclounge/mutations.js index 93dceaa0..467f512b 100644 --- a/src/store/modules/synclounge/mutations.js +++ b/src/store/modules/synclounge/mutations.js @@ -70,4 +70,8 @@ export default { SET_HOST_TIMELINE: (state, timeline) => { state.hostTimeline = timeline; }, + + SET_HOST_LAST_RATING_KEY: (state, ratingKey) => { + state.hostLastRatingKey = ratingKey; + }, };