Commit a2211f94 authored by haiyoucuv's avatar haiyoucuv

music

parent 98fab2ad
...@@ -7,6 +7,8 @@ import modalStore from "@src/store/modal"; ...@@ -7,6 +7,8 @@ import modalStore from "@src/store/modal";
import { _throttle } from "@src/utils/utils"; import { _throttle } from "@src/utils/utils";
import { Button } from "../Button"; import { Button } from "../Button";
import DPlayer from "dplayer"; import DPlayer from "dplayer";
import musicStore from "@src/store/musicStore";
import { RES_PATH } from "../../../sparkrc";
@observer @observer
class LongImgPop extends React.Component { class LongImgPop extends React.Component {
...@@ -33,9 +35,11 @@ class LongImgPop extends React.Component { ...@@ -33,9 +35,11 @@ class LongImgPop extends React.Component {
}); });
this.dp.on("play", () => { this.dp.on("play", () => {
this.startInterval(); this.startInterval();
musicStore.stopSound(RES_PATH + "audio/bgm.mp3");
}); });
this.dp.on("pause", () => { this.dp.on("pause", () => {
// this.endCountDown() // this.endCountDown()
musicStore.playSound(RES_PATH + "audio/bgm.mp3", true);
}); });
} }
if (this.props.popData?.noCount) { if (this.props.popData?.noCount) {
......
...@@ -64,6 +64,13 @@ const musicStore = makeAutoObservable(new class { ...@@ -64,6 +64,13 @@ const musicStore = makeAutoObservable(new class {
howl.play(); howl.play();
} }
async stopSound(src) {
const howl = await loadAudio(src);
if (howl) {
howl.stop();
}
}
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment