diff --git a/package-lock.json b/package-lock.json index 5128c2b..7d12192 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11267,6 +11267,11 @@ "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz", "integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==" }, + "vue-blurhash": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/vue-blurhash/-/vue-blurhash-0.1.2.tgz", + "integrity": "sha512-VfIiQW2+F1HsJktumGsEwCsp0CYLdnmTcCA3nMvZ8Bze8bkpp9tonIygzBnjUKN0WZyOxb22i9QQ+lqgngjedA==" + }, "vue-color": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/vue-color/-/vue-color-2.7.1.tgz", diff --git a/package.json b/package.json index ace6eaf..9975850 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "jquery": "^3.5.1", "music-metadata": "^7.4.1", "vue": "^2.6.12", + "vue-blurhash": "^0.1.2", "vue-router": "^3.4.7", "vuex": "^3.5.1" }, diff --git a/src/components/Main.vue b/src/components/Main.vue index 7b78193..9c10e15 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -33,7 +33,6 @@ import { Howl } from 'howler' import { generateUrl } from '@nextcloud/router' import { showError } from '@nextcloud/dialogs' import axios from '@nextcloud/axios' -import store from '../store' let audioPlayer = null @@ -109,8 +108,6 @@ export default { * @param {Object} station Station object */ doPlay(station) { - this.player.isPlaying = true - if (audioPlayer !== null) { audioPlayer.fade(1, 0, 500) // FIXME persistent volume state // FIXME fade out @@ -119,6 +116,7 @@ export default { { 'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work }) + const vm = this audioPlayer = new Howl({ src: [station.url_resolved], volume: 0, @@ -128,15 +126,16 @@ export default { } }, onplay() { - store.player.isPlaying = true - store.player.isBuffering = false + vm.$store.dispatch('isPlaying', true) + vm.$store.dispatch('isBuffering', false) }, onpause() { - store.player.isPlaying = false - store.player.isBuffering = false + vm.$store.dispatch('isPlaying', false) + vm.$store.dispatch('isBuffering', false) }, onload() { - store.player.isBuffering = true + vm.$store.dispatch('isPlaying', true) + vm.$store.dispatch('isBuffering', true) }, }) audioPlayer.play() diff --git a/src/components/Player.vue b/src/components/Player.vue index a9fb9a8..af402f0 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -19,7 +19,6 @@ value="this.volume" @input="changeVolume"> - {{ player.isPlaying }} @@ -28,7 +27,11 @@ export default { data: () => ({ sliderVal: 0, }), - inject: ['player'], + computed: { + player() { + return this.$store.state.player + }, + }, methods: { changeVolume() { this.$emit('changeVolume', this.sliderVal) diff --git a/src/components/Table.vue b/src/components/Table.vue index 3bcd17f..47ae330 100644 --- a/src/components/Table.vue +++ b/src/components/Table.vue @@ -15,10 +15,14 @@ :key="idx" :class="{ selected: idx === activeItem}">