Update shaka and fix ui

This commit is contained in:
Travis Shivers 2020-06-18 21:24:47 -05:00
parent 477b1b955f
commit 974545f0c8
11 changed files with 28 additions and 27 deletions

6
package-lock.json generated
View File

@ -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"

View File

@ -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",

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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,
};

View File

@ -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,

View File

@ -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']);
},

View File

@ -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.`,

View File

@ -70,4 +70,8 @@ export default {
SET_HOST_TIMELINE: (state, timeline) => {
state.hostTimeline = timeline;
},
SET_HOST_LAST_RATING_KEY: (state, ratingKey) => {
state.hostLastRatingKey = ratingKey;
},
};