diff --git a/src/components/Player.vue b/src/components/Player.vue index c28eaa9..6065fdd 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -117,6 +117,7 @@ import { isLoggedIn } from "@/utils/auth"; import { userLikedSongsIDs } from "@/api/user"; import { likeATrack } from "@/api/track"; import "@/assets/css/slider.css"; +import { Howler } from "howler"; import ButtonIcon from "@/components/ButtonIcon.vue"; import VueSlider from "vue-slider-component"; @@ -145,7 +146,7 @@ export default { } }, computed: { - ...mapState(["player", "howler", "Howler", "settings", "liked"]), + ...mapState(["player", "howler", "settings", "liked"]), currentTrack() { return this.player.currentTrack; }, @@ -155,7 +156,7 @@ export default { }, set(value) { this.updatePlayerState({ key: "volume", value }); - this.Howler.volume(value); + Howler.volume(value); }, }, playing() { diff --git a/src/store/index.js b/src/store/index.js index 7de0a21..836ebcb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,7 +4,7 @@ import state from "./state"; import mutations from "./mutations"; import actions from "./actions"; import initState from "./initState"; -import { Howl } from "howler"; +import { Howl, Howler } from "howler"; if (localStorage.getItem("appVersion") === null) { localStorage.setItem("player", JSON.stringify(initState.player)); @@ -36,5 +36,6 @@ store.state.howler = new Howl({ html5: true, format: ["mp3"], }); +Howler.volume(store.state.player.volume); export default store; diff --git a/src/store/initState.js b/src/store/initState.js index 785731a..bdec04f 100644 --- a/src/store/initState.js +++ b/src/store/initState.js @@ -1,7 +1,4 @@ -import { Howler } from "howler"; - const initState = { - Howler: Howler, howler: null, liked: { songs: [], diff --git a/src/store/mutations.js b/src/store/mutations.js index 1965dc0..7953f81 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -1,4 +1,4 @@ -import { Howl } from "howler"; +import { Howl, Howler } from "howler"; import state from "./state"; import { shuffleAList } from "@/utils/common"; @@ -10,7 +10,7 @@ export default { state.player.currentTrack = track; }, replaceMP3(state, mp3) { - state.Howler.unload(); + Howler.unload(); state.howler = new Howl({ src: [mp3], autoplay: true, diff --git a/src/store/state.js b/src/store/state.js index 2a3e1cd..d2d5dfd 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -1,7 +1,4 @@ -import { Howler } from "howler"; - export default { - Howler: Howler, howler: null, liked: { songs: [],