mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2025-02-22 15:01:58 +00:00
fix(video player): move console error to snackbar, add comments for typescript errors
This commit is contained in:
parent
110a7bb3a7
commit
f129cc0e75
@ -15,6 +15,7 @@ import shaka from 'shaka-player/dist/shaka-player.ui';
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
import muxjs from 'mux.js';
|
||||
import { mapActions } from 'vuex';
|
||||
import 'shaka-player/dist/controls.css';
|
||||
|
||||
declare global {
|
||||
@ -38,7 +39,9 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
source: '',
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
player: null as any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ui: null as any
|
||||
};
|
||||
},
|
||||
@ -48,7 +51,12 @@ export default Vue.extend({
|
||||
try {
|
||||
await this.player.load(newSource);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error code', e.code, 'object', e);
|
||||
this.pushSnackbarMessage({
|
||||
message: this.$t('unexpectedError'),
|
||||
error: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +77,10 @@ export default Vue.extend({
|
||||
}
|
||||
|
||||
if (mediaSource.SupportsDirectStream) {
|
||||
const directOptions: Record<string, any> = {
|
||||
const directOptions: Record<
|
||||
string,
|
||||
string | boolean | undefined | null
|
||||
> = {
|
||||
Static: true,
|
||||
mediaSourceId: mediaSource.Id,
|
||||
deviceId: this.$store.state.deviceProfile.deviceId,
|
||||
@ -120,6 +131,9 @@ export default Vue.extend({
|
||||
this.player.unload();
|
||||
this.player.destroy();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('snackbar', ['pushSnackbarMessage'])
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -29,7 +29,7 @@ export default Vue.extend({
|
||||
ids: [this.$route.params.itemId]
|
||||
});
|
||||
|
||||
if (response?.data?.Items && response.data.Items.length > 0) {
|
||||
if (response?.data?.Items?.[0]) {
|
||||
this.item = response.data.Items[0];
|
||||
} else {
|
||||
throw new Error('Item not found');
|
||||
|
Loading…
x
Reference in New Issue
Block a user